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