n=int(input()) g=0 def solve(a,b): c=0 for i in range(33): if (a>>i)&1==1 and (b>>i)&1==0: return 0 if (a>>i)&1==1 and (b>>i)&1==1: c+=1 if c>0: return (2**(c-1))+1 else: return 1 for i in range(1,10**5): if i*i>n: break if n%i==0: a=i b=n//i g+=solve(a,b) if a