#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
int knight_x[8] = {-2, -2, 2, 2, 1, -1, 1, -1};
int knight_y[8] = {1, -1, 1, -1, 2, 2, -2, -2};
int dir_x[4] = {1, -1, 0, 0};
int dir_y[4] = {0, 0, 1, -1};
long long comp(long long a, long long b) {
  if (a > b) return a;
  return b;
}
int power(int n, int k) {
  if (k == 0) return 1;
  return n * power(n, k - 1);
}
int neg(int n) {
  if (n < 0)
    return n * -1;
  else
    return n;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    unsigned long long a, b, n, odd = 0, even = 0, i, j, ans = 0;
    cin >> n;
    while (n) {
      ans += n;
      n /= 2;
    }
    cout << ans << '\n';
  }
  return 0;
}
