#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
long long fastPow(long long a, long long b) {
  long long res = 1;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    long long ans = n;
    long long tmp = 1;
    long long k = n * 2;
    while (fastPow(2, tmp) <= k) {
      tmp++;
      n /= 2;
      ans += n;
    }
    cout << ans << '\n';
  }
  return 0;
}
