#include<iostream>
#include<vector>
#include<set>
using namespace std;
int main()
{
int n,m;
int res = 0;
cin >> n >> m;
while (n != 0)
{
n = n & (n - 1);
res++;
}
cout << "F1:"<<res << endl;
res = 0;
while(m!=0)
{
int x = m&1;
if(x == 1)
{
res++;
}
m = m >> 1;
}
cout << "F2:" << res << endl;
return 0;
}