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