/* package whatever; // don't place package name! */
 
import java.util.*;
import java.lang.*;
import java.io.*;
 
/* Name of the class has to be "Main" only if the class is public. */
class First
{
	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));
        System.out.println(hitungNomorBit(13, 3));
	}
 
	public static Integer hitungNomorBit(int angka, int nomorBit) {
		if (nomorBit != 0 && nomorBit != 1) {
			return null;
		}
 
		Integer answer = 0;
 
		if (angka == 0) {
			return nomorBit == 0 ? 1 : 0;
		}
 
		while (angka != 0) {
			if ((angka & 1) == nomorBit) {
				answer += 1;
			}
 
			angka = angka >>> 1;
 
		}
 
		return answer;
 
	}
}