#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ans = 0;
    for (long long p2 = 1; p2 <= n; p2 *= 2) {
      ans += n / p2;
      if (p2 > LLONG_MAX / 2) break;
    }
    cout << ans << "\n";
  }
}
