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