N = int(input()) count = 0 while True: if N == 1: break if N % 2 == 0: N = N // 2 count += 1 else: N += 1 N = N // 2 count += 2 print(count)