/*
分析:
水题。
注意两种特殊情况:
1、0*0+x*x=n,这时候count+=4;
2、x*x+x*x=n,这时候也是count+=4;
然后让a(代码中的)从1开始循环就行了,不用从0开始。
2012-04-15
*/
分析:
水题。
注意两种特殊情况:
1、0*0+x*x=n,这时候count+=4;
2、x*x+x*x=n,这时候也是count+=4;
然后让a(代码中的)从1开始循环就行了,不用从0开始。
2012-04-15
*/
#include"stdio.h"
#include"math.h"
int main()
{
int n;
int count;
int a,b;
int t;
int temp;
while(scanf("%d",&n)!=-1)
{
if(n==0)
{
printf("1\n");
continue;
}
count=0;
t=n/2;
a=1;
while(a*a<t)
{
temp=n-a*a;
b=sqrt(temp);
if(b*b==temp)
count+=8;
a++;
}
if((int)sqrt(n)*(int)sqrt(n)*2==n)
count+=4;
if((int)sqrt(n)*(int)sqrt(n)==n)
count+=4;
printf("%d\n",count);
}
return 0;
}