N = int(input()) ans = 0 while N > 1: if N & 1 == 0: ans += 1 N >>= 1 else: ans += 1 N += 1 print(ans)