N = bin(~-int(input()))[2:] print(N.count('0') + len(N) if N != '0' else 0)