递归

def to2(x, n = 0):
    if x%2 == 1:
        n += 1
    if x < 1:
        print(n)
    else:
        to2(x//2, n)

to2(int(input()))