N = int(input()) c = 1 # クッキー☆ count = 0 d = N - c # demand while N >= 2 * c: c = 2*c d = N - c count += 1 if d < c: c += d count += 1 print(count)