#include <bits/stdc++.h>
using namespace std;
int chkpower2(int x) { return (x && !(x & x - 1)); }
void solve() {
  long long int i1 = 1, n, ans = 0;
  cin >> n;
  while (i1 <= n) {
    ans += n / i1;
    i1 = i1 * 2;
  }
  cout << ans;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
