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