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