def f(n): if n==1: return 0 elif n%2: return f((n+1)//2)+2 else: return f(n//2)+1 N=int(input()) print(f(N))