def main(): N = int(input()) if N == 1: print(0) return i = N n = 0 while i > 1: if i & 1: i += 1 n += 1 i //= 2 n += 1 print(n) main()