import math N = int(input()) twoN = math.pow(N, 2) count = 0 for x in range(N): for y in range(N): dx = math.pow(x, 2) dy = math.pow(y, 2) if dx + dy == twoN: count += 1 elif dx + dy > twoN: continue print(count)