#include <stdio.h>
using namespace std;
int main () {
int N,m,tool;
scanf("%d",&N);
while (N--){
scanf("%d",&m);
tool=0;
while(m){
if (m&1){
m=m/2;
tool++;
}
else
m=m/2;
}
printf("%d\n",tool);
}
return 0;
}
using namespace std;
int main () {
int N,m,tool;
scanf("%d",&N);
while (N--){
scanf("%d",&m);
tool=0;
while(m){
if (m&1){
m=m/2;
tool++;
}
else
m=m/2;
}
printf("%d\n",tool);
}
return 0;
}