#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{";
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) os << ", ";
    os << v[i];
  }
  os << "}";
  return os;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
bool cmp(const pair<long long, long long>& a,
         const pair<long long, long long>& b) {
  if (a.first == b.first) return (a.second >= b.second);
  return (a.first < b.first);
}
vector<long long> primes;
vector<long long> seive;
void Seive(long long n) {
  seive.resize(n + 5, 1);
  seive[1] = 0, seive[0] = 0;
  for (int i = 2; i * i < n + 5; i++) {
    if (seive[i]) {
      for (int j = 2 * i; j < n + 5; j += i) {
        seive[j] = 0;
      }
    }
  }
}
long long power(long long x, long long y, long long m = 1000000007) {
  long long int res = 1;
  x = x % m;
  while (y > 0) {
    if (y & 1) res = (res * x) % m;
    y = y >> 1;
    x = (x * x) % m;
  }
  return res;
}
long long modinv(long long x, long long mod = 1000000007) {
  return power(x, mod - 2, mod);
}
long long n, m;
long long A[300060];
long long diff(long long a, long long b) {
  vector<long long> v, v1;
  while (a) {
    v.push_back(a & 1);
    a /= 2;
  }
  while (b) {
    v1.push_back(b & 1);
    b /= 2;
  }
  sort(v.begin(), v.end());
  sort(v1.begin(), v1.end());
  if (v.size() < v1.size()) {
    swap(v, v1);
  }
  for (auto it : v) cout << it << " ";
  cout << endl;
  for (auto it : v1) cout << it << " ";
  cout << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int k, t, a, b, c, d;
  t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    long long i = 1;
    long long p = 0;
    while (i <= n) {
      p += n / i;
      i *= 2;
    }
    cout << p << endl;
  }
}
