#include <iostream>
using namespace std;
//此时使用的lowbit()来得到最后一个1以及后面的0
int lowbit(int x) {
return x & (-x);
}
int main() {
int n;
cin >> n;
while (n --) {
int x;
cin >> x;
int res = 0;
while (x) x -= lowbit(x), res ++;
cout << res << ' ';
}
return 0;
}