n=int(input()) ans=0 for i in range(1,1000): for j in range(1,1000): if i**2+j**2==n: ans+=1 print(ans)