#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using namespace std;
void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  ll i = 1;
  while (n >= i) {
    ans += (n / i);
    i *= 2;
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
