N = int(input()) M = N**2 S = {i**2 for i in range(1, N)} ans = 0 for i in range(1, N): ans += (M-i**2 in S) print(ans)