#include <bits/stdc++.h>
using namespace std;
const long long logN = 20;
const long long M = 1000000007;
const long long INF = 1e18;
const long long N = 100005;
void solve() {
  long long n;
  cin >> n;
  long long p = 1;
  long long cnt = 0;
  while (n >= p) {
    cnt += n / p;
    p = p * 2;
  }
  cout << cnt << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long no;
  cin >> no;
  while (no--) {
    solve();
  }
  return 0;
}
