#include <bits/stdc++.h>
using namespace std;
long long fastPowMod(long long a, long long p, long long mod) {
  if (p == 0) return 1;
  long long z = fastPowMod(a, p / 2, mod);
  z = (z * z) % mod;
  if (p % 2) z = (z * a) % mod;
  return z;
}
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v) is >> x;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
  }
  return os;
}
void solve() {
  long long n;
  cin >> n;
  long long x = 1;
  long long ans = 0;
  while (n / x > 0) {
    ans += n / x;
    x *= 2;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
    cout << "\n";
  }
  return 0;
}
