#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int maxx = 5e5 + 10;
inline int read() {
  long long x = 0;
  bool f = 0;
  char ch = getchar();
  while (ch < '0' || '9' < ch) f |= ch == '-', ch = getchar();
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
int t;
long long n;
void solve() {
  long long len = n << 1;
  while (n) {
    if (n & 1) {
      len--;
    }
    n >>= 1;
  }
  cout << len << endl;
}
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    solve();
  }
  return 0;
}
