#include <bits/stdc++.h>
using namespace std;
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int testcases;
  cin >> testcases;
  while (testcases--) {
    long long n;
    cin >> n;
    cout << 2 * n - __builtin_popcountll(n) << "\n";
  }
  return 0;
}
