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