import math N=int(input()) ans=0 for i in range(1,N): a=i b2=N*N-a*a b=round(math.sqrt(b2)) if a*a+b*b==N*N: ans+=1 print(ans)