#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979;
const long long INF = 1e15 + 7;
const long long MOD = 998244353;
const long long nax = 200005;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    long long n, ans = 0;
    cin >> n;
    while (n) {
      ans += n;
      n /= 2;
    }
    cout << ans << "\n";
  }
  return 0;
}
