#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
/*
另解:lowbit:return x & -x,提取一个数种二进制表示的最低位的1的值
如:12 = 1100,lowbit结果是4.
因为原码和补码相与的结果是:最低位的1及之后的0不变
*/
const int N = 100010;
int n;
int a[N];
int main()
{
cin >> n;
for(int i = 0; i < n; i ++ ) scanf("%d", &a[i]);
for(int i = 0; i < n; i ++ )
{
int t = a[i], res = 0;
while(t)
{
res += t & 1;
t >>= 1;
}
printf("%d ", res);
}
return 0;
}