#include <bits/stdc++.h>
using namespace std;
string toBinary(long long n) {
  string r;
  while (n != 0) {
    r = (n % 2 == 0 ? "0" : "1") + r;
    n /= 2;
  }
  return r;
}
int main() {
  int total;
  cin >> total;
  while (total--) {
    string binaryNum;
    long long num;
    cin >> num;
    binaryNum = toBinary(num);
    long long length = binaryNum.length();
    long long counter = 1;
    long long ans = 0;
    long long powers = 2;
    long long value = 0;
    ans = ans + num;
    while (counter < length) {
      value = num / powers;
      ans = ans + value;
      powers = powers * 2;
      counter++;
    }
    cout << ans << endl;
  }
}
