#include <iostream>
using namespace std;
int lowbit(int x) {
return x & -x;
}
int main() {
int n;
cin >> n;
while (n --) {
int x;
cin >> x;
//此时因为res是局部变量, 在每一次循环中一定将res重新设置成为0
int res = 0;
while (x) {
x -= lowbit(x);
res ++;
}
cout << res << ' ';
}
return 0;
}