#include <bits/stdc++.h>
using namespace std;
long long T, N;
signed main() {
  cin >> T;
  for (long long t = 0; t < T; t++) {
    cin >> N;
    long long ones = 0;
    for (long long n = 0; n < 64; n++)
      if ((N >> n) & 1 == 1) ones++;
    cout << N * 2 - ones << endl;
  }
}
