#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long gcd(long long a,long long b){
if(b==0) return a;
else return gcd(b,a%b);
}
long long n,ans=0;
long long calc(long long r){//和为r,且互质
long long sum=0;
long long i,temp;
for(i=1;i*i<r;i++){
temp=r-i*i;
temp=(int)sqrt((double)temp);
if(temp<=i) break;
if(temp*temp+i*i==r&&gcd(i,temp)==1&&((temp*temp-i*i)&1)){
//互质的勾股数,一条直角边为奇数,这样可以去重!
sum++;
}
}
return sum*2;
}
int main(){
freopen("cir.in","r",stdin);
freopen("cir.out","w",stdout);
cin>>n;
long long i;
for(i=1;i*i<=n;i++){
if(n%i) continue;
ans+=calc(i);
if(i*i==n) break;
ans+=calc(n/i);
}
cout<<ans*4+4<<endl;
return 0;
}