n = int(input()) S = set() for i in range(1, n+1): S.add(i**2) ans = 0 z = n**2 for x in S: y = z-x if y in S: ans += 1 print(ans)