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