import java.util.Scanner;

public class CountBitsOne {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        System.out.println(countPositiveBits(n));
    }

    public static int countPositiveBits(int n) {
        int count = 0;

        while (n > 0) {
            if ((n & 1) == 1) {
                count++;
            }
            n >>= 1;
        }

        return count;
    }
}

Solve homework2-problem7: Count of Bits One