n=int(input()) h=set() i=1 while i<=n: h.add(i**2) i+=1 ans=0 x=1 while x<=n: y2=n**2-x**2 if y2 in h:ans+=1 x+=1 print(ans)