n = int(input()) ans = 0 for x in range(1, 2000): for y in range(1,2000): if x * x + y * y == n * n: ans += 1 print(ans)