#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
const int N=100000+10;
int n,x;
int lowbit_(int x)
{
return x&-x;
}
int fun(int x)
{
int cnt=0;
while(x)
{
cnt+=1;
x-=lowbit_(x);
}
return cnt;
}
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&x);
printf("%d ",fun(x));
}
return 0;
}