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