#include <bits/stdc++.h>
using namespace std;
void solve() {
  unsigned long long int n;
  cin >> n;
  unsigned long long int b[100];
  b[0] = 1;
  for (unsigned long long int i = 1; i <= 99; ++i) b[i] = 2 * b[i - 1] + 1;
  unsigned long long int ans = 0, c = 0;
  while (n) {
    if (n & 1) ans += b[c];
    n >>= 1;
    c++;
  }
  cout << ans << "\n";
}
int main() {
  std::ios_base::sync_with_stdio(false);
  unsigned long long int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
