N = int(input()) num = set() for i in range(1, N+1): num.add(i**2) res = 0 for i in range(1,N+1): if N**2-i**2 in num: res += 1 print(res)