#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n, sum = 0;
    cin >> n;
    while (n != 0) {
      sum += n;
      n = n >> 1;
    }
    cout << sum << "\n";
  }
}
