#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
int main()
{
cin>>n;
while (n -- )
{
int x;
cin>>x;
int cnt=0;
while(x)
{
if(x&1==1) cnt++;//取出每一位 与 1 进行与运算 相同为 1 不同为 0
x>>=1;//将x的二进制表示向右移动 1 位
}
cout<<cnt<<" ";
}
return 0;
}