N = int(input()) N2 = N**2 s = {i**2:1 for i in range(1, N+1)} cnt = 0 for i in range(1, N+1): cnt += N2-i**2 in s print(cnt)