while True:
    num = int(input())
    if num == 0:
        break
    count = 0
    while True:
        if num % 2 == 1:
            count += 1
            num = num // 2
        else:
            print(count)
            break