import math N=int(input()) ans=0 for x in range(1,N): y=int(math.sqrt(N*N-x*x)) if y*y+x*x==N*N:ans+=1 print(ans)