#刚开始学写的
while True:
try:x = int(input())
count = 0
y = list(bin(x))
for i in y:
if i == '1':
count += 1
print(count)
except:
break
#做了50道题后写的
while True:
try:
x = int(input())
y = bin(x)
count1 = y.count('1')
print(count1)
except:
break
try:
x = int(input())
y = bin(x)
count1 = y.count('1')
print(count1)
except:
break