#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 100;
const long long inf = 1e18 + 100;
long long A[N], B[N], s[N];
vector<long long> v;
inline void read(long long &p) {
  p = 0;
  char ch = getchar();
  long long t = 1;
  while (ch != '-' && (ch > '9' || ch < '0')) ch = getchar();
  if (ch == '-') t = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') p = p * 10 + ch - '0', ch = getchar();
  p *= t;
}
int main() {
  long long T, n;
  read(T);
  while (T--) {
    long long ans = 0;
    read(n);
    for (int i = 0; i < 63; i++) {
      long long k = (1ll << i);
      ans += n / k;
    }
    cout << ans << endl;
  }
  return 0;
}
