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