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