#include <bits/stdc++.h>
using namespace std;
int t;
long long n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> t;
  while (t--) {
    cin >> n;
    cout << (2 * n) - (__builtin_popcountll(n)) << '\n';
  }
}
