#include <bits/stdc++.h>
using namespace std;
int set_bit(long long n) {
  int c = 0;
  for (int i = 0; i <= 18; ++i) {
    if (n & 1L << i) {
      ++c;
    }
  }
  return c;
}
int main() {
  long long t;
  cin >> t;
  while (t) {
    long long n;
    cin >> n;
    long long sum = 0;
    for (int i = 0; i <= 64; ++i) {
      sum += n / (long long)pow(2, i);
    }
    cout << sum << endl;
    --t;
  }
  return 0;
}
