#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <typename T>
T binpow(T a, T b, T mod) {
  T res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % mod;
    }
    b /= 2;
    (a *= a) %= mod;
  }
  return res;
}
template <typename T>
T binpow(T a, T b) {
  T res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a);
    }
    b /= 2;
    a *= a;
  }
  return res;
}
template <typename T>
T add(T a, T b) {
  return (a + b) % mod;
}
template <typename T>
T sub(T a, T b) {
  return add(a, mod - b);
}
template <typename T>
T mul(T a, T b) {
  return (a * b) % mod;
}
long long make_int(string s) {
  long long x = 0;
  reverse(s.begin(), s.end());
  string tmp = s;
  for (long long i = 0; i < s.length(); ++i) {
    x *= 10;
    x += (long long)(tmp.back() - '0');
    tmp.pop_back();
  }
  return x;
}
string make_string(long long s) {
  string x;
  while (s) {
    x.push_back(char(s % 10 + '0'));
    s /= 10;
  }
  reverse(x.begin(), x.end());
  return x;
}
const long long inf = 1e18 + 5;
long long calc(long long a, long long b) {
  long long ans = 0;
  for (long long i = 0; i < 62; ++i) {
    if (((a >> i) & 1) ^ ((b >> i) & 1)) {
      ans++;
    }
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n;
    cin >> n;
    long long res = 0;
    long long div = 1;
    while (n / div) {
      res += n / div;
      div *= 2;
    }
    cout << res << '\n';
  }
  return 0;
}
