方法2
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
while(n -- )
{
int m;
cin >> m;
int ans = 0;
while(m)
{
m = m & ~(m & -m);
ans ++;
}
cout << ans << " ";
}
return 0;
}