01 #include <iostream>
02 using namespace std;
03
04 int n;
05 int a[1000];
06
07 int f(int x)
08 {
09 int ret = 0;
10 for (; x; x &= x - 1) ret++;
11 return ret;
12 }
13
14 int g(int x)
15 {
16 return x & -x;
17 }
18
19 int main()
20 {
21 cin >> n;
22 for (int i = 0; i < n; i++) cin >> a[i];
23 for (int i = 0; i < n; i++)
24 cout << f(a[i]) + g(a[i]) << ' ';
25 cout << endl;
26 return 0;
27 }