#include <iostream>
#include <bitset>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    int count1 = 0, count2 = 0;
    bitset<32> b1(n);
    bitset<32> b2(m);
    string str1 = b1.to_string();
    string str2 = b2.to_string();
    for(int i = 0; i < 32; ++i) {
        if(str1[i] == '1') ++count1;
        if(str2[i] == '1') ++count2;
    }
    cout << count1 << endl;
    cout << count2 << endl;
    return 0;
}

bitset真好用