N = int(input()) X = 1 count = 0 if N == X: pass else: while X < N: X *= 2 count += 1 count += (X - N) print(count)