N = int(input()) print(sum(1 for i in range(1, N) if int((Y := N * N - i * i) ** 0.5) ** 2 == Y))