import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 0; i < n; ++i){
int k = sc.nextInt();
countOneInBinanry(k);
}
}
public static void countOneInBinanry(int k){
int count = 0;
while(k != 0){
if((k&1)==1){
count++;
}
k >>>= 1;
}
System.out.print(count + " ");
}
}