N = int(input()) F = {i*i for i in range(1, N+1)} cnt = 0 for x in range(1, N+1): if N*N - x*x in F: cnt += 1 print(cnt)