#include using namespace std; using ll = long long; using ull = unsigned long long; constexpr int MOD=998244353; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep2(i,l,r) for(int i=(l);i<(int)(r);i++) #define all(v) v.begin(),v.end() void solve(); int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int test_case; cin>>test_case; while (test_case--){ solve(); } } void solve(){ ll N; cin>>N; N++; ll ans=0; rep(i,40){ ans+=(N/(2ll<