N = int(input()) S = set() Ans = 0 for i in range(1, N + 1): S.add(i * i) for i in range(1, N + 1): if N * N - i * i in S: Ans += 1 print(Ans)