#yuki1593 import math n=int(input()) res=0 for x in range(1,n): y=math.isqrt(n*n-x*x) if x*x+y*y==n*n: res+=1 print(res)