N = int(input()) c = 0 while N > 0: i = 0 while 2**i < N: i += 1 N -= 2**i c += i print(c)