#include <bits/stdc++.h>
using namespace std;
const int MX = 10010896;
const int lmt = 3164;
const int N = 10000001;
const int MOD = 1000000007;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, p, temp = 0;
    cin >> n;
    p = 2 * n;
    while (n > 0) {
      if (n % 2 != 0) temp++;
      n = n / 2;
    }
    cout << p - temp << endl;
  }
}
