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