N = int(input()) ans = 0 from math import sqrt for x in range(1,N): yy = N *N - x * x if yy == int(sqrt(y)) ** 2:ans += 1 print(ans)