/**************Powered by Graphene Richards**************/ //{ #define FLOAT_PRECISION 2 #define INT_64_MOD "%I64d" #define UNSIGNED_64_MOD "%I64u" #ifdef _MSC_VER #define _SECURE_SCL 0 #pragma comment(linker,"/STACK:102400000,102400000") #else #pragma GCC optimize("O3") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx") #endif #if defined(_MSC_VER)||__cplusplus>199711L #define IT(x) auto #define DIT(x) auto #else #define IT(x) __typeof((x).begin()) #define DIT(x) __typeof((x).rbegin()) #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define FAST_RW ios_base::sync_with_stdio(0),cin.tie(0); #define FS(i,a) for(ll i=0;a[i];i++) #define FE(x,ctn) for(IT(ctn) x=(ctn).begin(),_en=(ctn).end();x!=_en;x++) #define EF(x,ctn) for(DIT(ctn) x=(ctn).rbegin(),_en=(ctn).rend();x!=_en;x++) #define FR(i,en) for(ll i=0,_en=(en);i<_en;i++) #define FOR(i,en) for(ll i=1,_en=(en);i<=_en;i++) #define RF(i,en) for(ll i=(en)-1;i>=0;i--) #define ROF(i,en) for(ll i=(en);i>0;i--) #define FFR(i,x,y) for(ll i=(x),_en=(y);i<=_en;i++) #define RFF(i,x,y) for(ll i=(x),_en=(y);i>=_en;i--) #define pc putchar #define pb push_back #define ppb pop_back #define pct __builtin_popcount #define pq priority_queue #define fi first #define se second #define mp make_pair #define pii pair #define pll pair #define sqr(x) ((x)*(x)) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define clr(x) memset((x),0,sizeof(x)) #define ms(x,v) memset((x),(v),sizeof(x)) #define mc(x,y) memcpy((x),(y),sizeof(y)) #define NL puts(""); #define LB lower_bound #define UB upper_bound #define RAND abs((rand()<<15)^rand()) typedef unsigned ui; typedef long long ll; typedef unsigned long long ull; typedef long double lf; using namespace std; ull gcd(ull a,ull b){if(!b)return a;while(b^=a^=b^=a%=b);return a;} extern const ll MOD; ll ksm(ll a,ll b){ ll res=1; a%=MOD; for(;b;b>>=1){ if(b&1)res=res*a%MOD; a=a*a%MOD; } return res; } #ifdef wmx16835 #include"wmx16835.h" #else #define LOG #define TEL #define PF #define PC #define SF(...) #define SC #define test(...) 0 #define TEST(...) 0 #define TRY(...) #define PP #define SHOW_TIME #define BR #endif templatebool In(T1 x,T2 y,T3 z){return x<=y&&x>=z||x<=z&&x>=y;} templateT1 max(const T1&a,const T2&b){return aT1 max3(const T1&a,const T2&b,const T3&c){return aT1 min(const T1&a,const T2&b){return aT1 min3(const T1&a,const T2&b,const T3&c){return abool S(T1&a,T2&b){return S(a)+S(b)==2;} templatebool S(T1&a,T2&b,T3&c){return S(a)+S(b)+S(c)==3;} templatebool S(T1&a,T2&b,T3&c,T4&d){return S(a)+S(b)+S(c)+S(d)==4;} templatebool S(T1&a,T2&b,T3&c,T4&d,T5&e){return S(a)+S(b)+S(c)+S(d)+S(e)==5;} templatevoid P(const T1&a){_P(a);pc(' ');} templatevoid P(const T1&a,const T2&b){_P(a);pc(' ');_P(b);pc(' ');} templatevoid PN(const T1&a){_P(a);NL} templatevoid PN(const T1&a,const T2&b){_P(a);pc(' ');_P(b);NL} templatevoid PN(const T1&a,const T2&b,const T3&c){_P(a);pc(' ');_P(b);pc(' ');_P(c);NL} templatevoid PN(const T1&a,const T2&b,const T3&c,const T4&d){_P(a);pc(' ');_P(b);pc(' ');_P(c);pc(' ');_P(d);NL} templatevoid PN(const T1&a,const T2&b,const T3&c,const T4&d,const T5&e){_P(a);pc(' ');_P(b);pc(' ');_P(c);pc(' ');_P(d);pc(' ');_P(e);NL} void PS(int a){printf("%*s",a,"");} templatevoid PA(T*a,int n){FR(i,n){if(i)pc(' ');_P(a[i]);}NL} templatevoid PA(const T&x){FE(it,x){if(it!=x.begin())pc(' ');_P(*it);}NL} int kase; const double pi=4*atan(1); const double ep=1e-9; const int INF=0x3f3f3f3f; const ll INFL=0x3f3f3f3f3f3f3f3fll; const ll MOD=1000000007; //} int main(){ SHOW_TIME int t; S(t); while(t--){ ll n; S(n); int res=0; while(n){ if(n&1){ res++; while(n&1)n/=2; } else n/=2; } PN(res); } } /*********Risoft corporation all rights reserved*********/ /**************Template V2.20 build 20150604*************/