#include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int count_ones(int n){
int sum=0;
while(n!=0){
n=n-(n&(-n));
sum++;
}
return sum;
}
int main()
{
int t,n;
scanf("%d",&t);
for(int i=0;i<t;i++){
scanf("%d",&n);
printf("%d
",count_ones(n));
}
return 0;
}