#include<stdio.h> int main() { int n,m,s; scanf("%d",&n); while(n--) { scanf("%d",&m); s=0; while(m) m&=m-1,s++; printf("%d\n",s); } return 0; }