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