#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n--) {
int t;
int cnt = 0;
cin >> t;
for (int i = 0; i < 32; i++) {
if ((t >> i) & 1 == 1) cnt++;
}
cout << cnt << ' ';
}
cout << endl;
return 0;
}