import math n = int(input()) ans = 0 for x in range(1, n): y_sq = n * n - x * x y = math.isqrt(y_sq) if y * y == y_sq and y >= 1: ans += 1 print(ans)