def is_square(M): low=0 high=M+10 while(high-low>1): mid=(high+low)//2 if mid*mid<=M: low=mid else: high=mid if low*low==M: return low else: return None N=int(input()) D={N} for i in range(1,N+1): if (N*N)%i==0: D.add(i) ans=set() for x in D: for y in D: ''' xyz(x+y+z)=N*N xy z*z+(x+y)xy*z-N*N=0 ''' A=x*y B=(x+y)*x*y C=-N*N DD=B*B-4*A*C SD=is_square(DD) if not(SD==None): if (-B-SD)%(2*A)==0: z=(-B-SD)//(2*A) if z>0: ans.add(tuple(sorted([x,y,z]))) if (-B+SD)%(2*A)==0: z=(-B+SD)//(2*A) if z>0: ans.add(tuple(sorted([x,y,z]))) print(len(ans))