N = int(input()) ans = 0 x = set(i**2 for i in range(1, 10**3)) for i in range(1, 10**3): if N**2-i**2 in x: ans += 1 print(ans)