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