N = int(input()) B = format(N, 'b') if B.count('1')==1: print(len(B)-1) else: print(len(B)+1+B.count('0'))