N = int(input()) s = set() for i in range(1,N+10): s.add(i**2) ans = 0 for x in range(1,N+1): if N**2 - x**2 in s: ans += 1 print (ans)