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