mport java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
for(int i=0;i<T;i++){
int n=sc.nextInt();
int setBit = 0;
while(n>0){
if((n & 1)!=0){
setBit++;
}
n = n>>1;
}
System.out.print(setBit);
}
}
}