n = int(input()) if n == 1: print(0) exit() b = format(n-1, 'b') ans = len(b) for i in range(len(b)): if b[i] == '0': ans += 1 print(ans)