# No.1593 Perfect Distance # https://yukicoder.me/problems/no/1593 from math import sqrt N = int(input()) Answer = 0 for x in range(1,N): V = N * N - x * x y = sqrt(V) // 1 if x * x + y * y == N * N: Answer += 1 print(Answer)