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