#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
vector<int> decimalToBiner(int angka){
	vector<int> biner;
 
	if(angka == 0){
		biner.push_back(0);
		return biner;
	}
 
	while(angka > 0){
		biner.push_back(angka%2);
		angka /= 2;
	}
 
	reverse(biner.begin(), biner.end());
	return biner;
}
 
int hitungNomorBit(int angka, int nomorBit){
	if(nomorBit != 1 && nomorBit != 0){
		return -1;
	}
 
	vector<int> biner = decimalToBiner(angka);
 
	int count = 0;
	for(int digit : biner){
		if(digit == nomorBit){
			count++;
		}
	}
 
	return count;
}
 
void tc(int angka, int nomorBit){
    int count = hitungNomorBit(angka, nomorBit);
    if (count == -1) cout << "null\n";
    else cout << count << "\n";
}
 
int main() {
	// int t; cin >> t;
	// while(t--){
	// 	solve();
	// }
 
	tc(13, 0);  
	tc(13, 1); 
	tc(13, 2);  
	return 0;
}