N = int(input()) ans = 0 L = set([i**2 for i in range(1,N)]) for i in range(1,N): if N**2 - i ** 2 in L: ans += 1 print(ans)