#include <bits/stdc++.h>
using namespace std;
int a[1005];
void solve() {
  long long n, cou = 0;
  scanf("%lld", &n);
  ;
  for (long long i = 1; i <= n; i *= 2) {
    long long v;
    if ((n + 1) % i == 0)
      v = (n + 1) / i;
    else
      v = (n + 1) / i + 1;
    cou += v - 1;
  }
  printf("%lld\n", cou);
}
int main() {
  int t;
  scanf("%d", &t);
  ;
  while (t--) {
    solve();
  }
}
