n = int(input())

nn = n**2
cnt = 0
for x in range(1, n):
    xx = x**2
    y = ((nn - xx)**0.5)
    if y.is_integer():
        cnt += 1

print(cnt)