n=int(input());ans=0 while n>1: s=1 while n%2==0: n>>=1;ans+=s;s=0 if n!=1: n+=1;ans+=1 print(ans)