@华为算法题

python实现

a = int(input())
c = 0
while a:
    b = a % 2
    if b:
        c += 1
    a = int(a/2)
print(c)