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