#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, i, p = 1, y = 0, x = 1, n;
  cin >> t;
  while (t--) {
    cin >> n;
    while (x) {
      if (n % (p * 2) == 0)
        x = n / (p * 2);
      else
        x = ceil(n / (p * 2));
      if (n % p == 0)
        y += n / p;
      else
        y = y + ceil(n / p);
      p = p * 2;
    }
    cout << y << endl;
    x = 1;
    p = x;
    y = 0;
  }
}
