#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T; cin >> T; while(T--){ long long n, ans = 0; cin >> n; while(n){ ll c = __lg(n), b = 1ll << c; ans += c * b / 2; n -= b; ans += n + 1; } cout << ans << '\n'; } }