N = int(input()) ans = 0 for x in range(1,N): yy = N*N-x*x if round(yy**.5)**2==yy: ans += 1 print(ans)