#include <bits/stdc++.h>
using namespace std;
struct lex_compare {
  bool operator()(const int& a, const int& b) const { return a < b; }
};
void solve() {
  long long n;
  cin >> n;
  long long ans = n;
  long long s = 2ll;
  while (s <= n) {
    ans += n / s;
    s *= 2ll;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
