n = int(input()) ans = 0 for x in range(1, n + 1): yy = n * n - x * x y = int(yy ** 0.5 + 10 ** (-14)) if x * x + y * y == n * n and y > 0: ans += 1 print(ans)