#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, sum, i;
  cin >> t;
  while (t--) {
    cin >> n;
    sum = 0;
    i = 0;
    while (n / (long long int)pow(2, i)) {
      sum += n / (long long int)pow(2, i);
      i++;
    }
    cout << sum << endl;
  }
}
