n = int(input()) import math res = 0 eps = 0.0000001 for i in range(1,n): #print(math.sqrt(n**2 - i**2)) if abs(math.sqrt(n**2 - i**2) - math.floor(math.sqrt(n**2 - i**2))) < eps: res += 1 print(res)