from math import isqrt N = int(input()) result = 0 for x in range(1, N): y = isqrt(N * N - x * x) if x * x + y * y == N * N: result += 1 print(result)