#include #include #include #include #include #define ll long long #define mst(a,x) memset(a,x,sizeof(a)) using namespace std; ll n; int tot, a[105], ans; int main() { int T; scanf("%d", &T); while(T--) { scanf("%I64d", &n); tot = 0; ans = 0; while(n) { a[tot++] = n & 1; if(a[tot - 1] == 1) { if(tot == 1 || a[tot - 2] == 0) ans++; } n >>= 1; } printf("%d\n", ans); } return 0; }