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