#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  long long num;
  while (t--) {
    cin >> num;
    long long ans = 0;
    while (num) {
      ans += num;
      num /= 2;
    }
    cout << ans << '\n';
  }
  return 0;
}
