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