#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long ans = 0;
    for (long long i = 60; i >= 0; i--) {
      long long val = 1LL << i;
      if (val > n + 1) continue;
      long long x = (n + 1) / val + ((n + 1) % val != 0);
      ans += (x - 1);
    }
    cout << ans << "\n";
  }
  return 0;
}
