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