#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
while(n--){
int x,ans=0;
cin >> x;
for (int i = x; i ; i -= i& -i ) ans++;
cout << ans <<' ';
}
return 0;
}