#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<iostream>
#include<string>
#include<cmath>
#define PR pair<long long,long long>
#define mp make_pair
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
typedef long long LL;
using namespace std;
set<PR> S;
LL gcd(LL a,LL b)
{
if (a%b==0) return b;
return gcd(b,a%b);
}
int squ(LL x)
{
if (x==0) return -1;
int t=(int)sqrt(x);
if (t*t==x) return t;
return -1;
}
void solve(LL x)
{
LL u,v;
FOR(u,1,(LL)sqrt(x))
{
int v=squ(x-u*u);
if (v!=-1)
{
if (gcd(u,v)!=1) continue;
LL tmp=x*(v*v-u*u);
if (tmp&1||tmp==0) continue;
S.insert(mp((LL)x*u*v,tmp/2));
}
}
}
int main()
{
int R,i;
scanf("%d",&R);
LL r=(LL)R<<1;
FOR(i,1,(int)(sqrt(r)))
if (r%i==0)
{
solve(i);
if (r/i!=i) solve(r/(LL)i);
}
printf("%d\n",S.size()*4+4);
}