N = int(input()) ans = 0 for x in range(1,N): z = N**2 - x**2 y = int(z**0.5) if y*y == z: ans += 1 print(ans)