#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  cout << "x= " << x << endl;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  cout << "res" << res << endl;
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p) % p;
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
struct input {
  int index, a, b;
  input(int x = -1, int y = -1, int z = -1) {
    index = x;
    a = y;
    b = z;
  }
};
bool cst(input p1, input p2) { return p1.b < p2.b; }
bool cst2(pair<int, int> p1, pair<int, int> p2) {
  return p1.second < p2.second;
}
long long int getsum(long long int n) {
  long long int m = (long long int)log2(n);
  long long int s = 0;
  for (int x = 1; x <= m; x++) {
    s = s + (long long int)(n / (long long int)pow(2, x));
  }
  return s;
}
long long int a[4] = {0, 1, 3, 4};
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    cout << n + getsum(n) << endl;
  }
}
