N=int(input()) def f(x): r=[] for i in range(1,int(x**0.5)+1): if x%i==0: y=x//i r.append((i,y)) if i!=y: r.append((y,i)) return r D=f(N) ANS=0 for d in D: a,b=d[0],d[1] if (a&b)!=b: continue if a==b: ANS+=1 else: ANS+=(1<<(bin(b).count('1')-1)) print(ANS)