import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	static Integer hitungNomorBit(int angka, int nomorBit) {
		if (nomorBit != 0 && nomorBit != 1) {
			return null;
		}
		
		String biner = "";
		int n = angka;
		
		if (n == 0) {
			biner = "0";
		}
		
		while (n > 0) {
			biner = (n % 2) + biner;
			n = n / 2;
		}
		
		int jumlah = 0;
		for (int i = 0; i < biner.length(); i++) {
			if (biner.charAt(i) - '0' == nomorBit) {
				jumlah++;
			}
		}
		
		return jumlah;
	}
	
	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println(hitungNomorBit(13, 0));
		System.out.println(hitungNomorBit(13, 1));
		System.out.println(hitungNomorBit(13, 2));
	}
}