n = int(input())
ans = 0
for x in range(1, n):
    y2 = n * n - x * x
    y = int((y2+0.5)**.5)
    if y * y == y2:
        ans += 1
print(ans)