n=int(input()) work=1 ans=0 while work>n**0.5: b=int((n-work**2)**0.5) if a**2+b**2==n: if a==b: ans+=1 else: ans+=2 print(ans)