#include<iostream>
using namespace std;
int lowbit(int x) {
int res = 0;
while (x) {
x -= (x & -x);
res++;
}
return res;
}
int main() {
int n;
cin >> n;
while (n -- ) {
int x;
cin >> x;
cout << lowbit(x) << " ";
}
cout << endl;
return 0;
}