#include<bits/stdc++.h>
using namespace std;
long long dp[61];

int main ()
{
    int t;

        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       long long ans = 0;
       int r = log2(n);
       unsigned long long m = 1;
       while(n!=0)
       {

        while(n<(m<<r))r--;
        long long f = m<<r;
        long long d = (n-f);
        ans+= (dp[r]+r+1);
        n=d;
        r--;
       }
       cout << ans << endl;

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[61];

int main ()
{
    int t;

        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       long long ans = 0;
       while(n!=0)
       {

        long long k = log2(n);
        unsigned long long f = 1;
        long long f = f<<k;
        long long d = (n-f);
        ans+= (dp[k]+k+1);
        n=d;
       }
       cout << ans << endl;

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[61];

int main ()
{
    int t;

        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       long long ans = 0;
       while(n!=0)
       {

        long long k = log2(n);
        unsigned long long m = 1;
        long long f = m<<k;
        long long d = (n-f);
        ans+= (dp[k]+k+1);
        n=d;
       }
       cout << ans << endl;

    }

    return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

ll N=70;

vector<ll> dp(N);

void pre()
{
    dp[0]=0;
    dp[1]=1;

    for(int i=2; i<N; i++)
    {
        dp[i]=2LL*dp[i-1]+i;
    }
}

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    pre();

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll cn=n, ans=0;

    	while(cn)
    	{
    	    ll x=log2(cn);
    	    ans+=dp[x]+log2(cn)+1;
    	    cn-=(1LL<<(x));
    	    //cout<<cn<<" ";
    	}
    	cout<<ans<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

ll N=61;

vector<ll> dp(N);

void pre()
{
    dp[0]=0;
    dp[1]=1;

    for(int i=2; i<N; i++)
    {
        dp[i]=2LL*dp[i-1]+i;
    }
}

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    pre();

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll cn=n, ans=0;

    	while(cn)
    	{
    	    ll x=log2(cn);
    	    ans+=dp[x]+(ll)(log2(cn))+1LL;
    	    cn-=(1LL<<(x));
    	    //cout<<cn<<" ";
    	}
    	cout<<ans<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

ll N=70;

vector<ll> dp(N);

void pre()
{
    dp[0]=0;
    dp[1]=1;

    for(int i=2; i<N; i++)
    {
        dp[i]=2LL*dp[i-1]+i;
    }
}

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    pre();

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll cn=n, ans=0;

    	while(cn)
    	{
    	    ll x=log2(cn);
    	    ans+=dp[x]+(ll)(log2(cn))+1LL;
    	    cn-=(1LL<<(x));
    	    //cout<<cn<<" ";
    	}
    	cout<<ans<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    while(T--)
    {
    	ll n;
    	cin>>n;

    	cout<<(2*n)-__builtin_popcountll(n)<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

ll N=64;

vector<ll> dp(N);

void pre()
{
    dp[0]=0;
    dp[1]=1;

    for(int i=2; i<N; i++)
    {
        dp[i]=2LL*dp[i-1]+i;
    }
}

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    pre();

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll cn=n, ans=0;

    	while(cn)
    	{
    	    ll x=log2(cn);
    	    ans+=dp[x]+log2(cn)+1;
    	    cn-=(1LL<<(x));
    	}
    	cout<<ans<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll ct=0;
    	ll tc=2*n;
        while(n>0)
        {
            ct+=n%2;
            n/=2;
        }
        cout<<tc-ct<<"\n";
    }

}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

const ll N=100;

ll dp[N];

void pre()
{
    dp[0]=0;
    dp[1]=1;

    for(ll i=2; i<N; i++)
    {
        dp[i]=(ll)(2LL*dp[i-1]+i);
    }
}

int main()
{
    FAST;

    ll T=1;
    cin>>T;

    for(int i=0; i<N; i++)
    {
        dp[i]=0;
    }

    pre();

    while(T--)
    {
    	ll n;
    	cin>>n;

    	ll cn=n, ans=0;

    	while(cn)
    	{
    	    ll x=log2(cn);
    	    ans+=(dp[x]+log2(cn)+1);
    	    cn-=(1LL<<(x));
    	    //cout<<cn<<" ";
    	}
    	cout<<ans<<"\n";
    }

}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n,ll &ans){
     if(n==0)return 0;

      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;
      return 1ll*pow(2,val+1)-1+rec(left,ans);

 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);
      ll ans=0;
      cout<<rec(n,ans);

      cout<<"\n";
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< long long int ,long long int > iil;

#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)

#define edl '\n'
#define ll long long int
#define ff first
#define ss second

#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )

#define GCP cout << "Case #" << nw++ << ": ";
#define filecode freopen("sample.txt","r",stdin);
#define IOFAST ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define setPrecision(n) cout << std::setprecision(n) << std::fixed;

#define MOD 1000000007
#define PI 3.14159265

bool comp ( ii a, ii b ){ return (a.ff==b.ff)?a.ss<b.ss:a.ff<b.ff; }
ll modInverse(ll a) { ll m = MOD;ll y = 0, x = 1;while (a > 1) {ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0) x += MOD;return x; }
ll binpow ( ll a, ll p ){ if ( p==0 ) return 1; ll ret = binpow(a,p/2); ret *= ret;ret %= MOD; if ( p%2 ){ret *= a;ret %= MOD;} return ret; }

void solve(){

    ll n;
    cin >> n;
    ll ans = 0;
    forn(i,62){
        ll pow = 1ll<<i;
        ll tmp = n/pow;
        ans += tmp;
    }
    cout << ans << edl;

}

int main() {
    IOFAST;int t = 1,nw = 1;
    cin >> t;
    while ( t-- ) {
        solve();
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n){
     if(n==0)return 0;
     if(n==1)return 1;
      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;

      return 1ll*pow(2,val+1)-1+rec(left) ;
 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);

      cout<<rec(n);

      cout<<"\n";
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n,ll ans){
     if(n==0)return ans;

      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;
      ans+=1ll*pow(2,val+1)-1;
      rec(left,ans);
 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);

      cout<<rec(n,1ll*0);

      cout<<"\n";
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n,ll ans){
     if(n==0)return ans;

      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;
      ans+=1ll*pow(2,val+1)-1;
      rec(left,ans);
 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);
      ll ans=0;
      cout<<rec(n,ans);

      cout<<"\n";
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n,ll &ans){
     if(n==0)return ans;

      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;
      ans+=1ll*pow(2,val+1)-1;
      rec(left,ans);
 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);
      ll ans=0;
      cout<<rec(n,ans);

      cout<<"\n";
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
//#include <boost/algorithm/string.hpp>
using namespace std;

#define ll long long int
#define in(n) int n; cin >> n;
#define inl(n) long long int n; cin >> n;
#define forn(i,n) for ( int i=0 ; i<n ; i++ )
#define forni(i,j,n) for ( int i=j ; i<n ; i++ )
#define fornn(i,n) for ( int i=n-1 ; i>=0 ; i-- )
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1073741824

 bool sortbysec(const pair<int,pair<int,int>> &a,
              const pair<int,pair<int,int>> &b)
{
    return (a.second < b.second);
}

 ll rec(ll n){
     if(n==0)return 0;

      ll val=log(n)/log(2);
     ll div= 1ll*pow(2,val);
     ll left=n%div;

      return 1ll*pow(2,val+1)-1+rec(left) ;
 }

int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ; cout.tie(0) ;
    inl(t);
    while(t--){
      inl(n);

      cout<<rec(n);

      cout<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long int
#define ld long double
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ld count=0;
        while(n>0)
        {
            count+=n;
            //cout<<count<<"\n";
            n/=2;
        }
        cout<<count<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    while(t--)
    {
        double n;
        cin>>n;
        double count=0;
        while(n>0)
        {
            count+=n;
            n=n/2;
        }
        cout<<count<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long int
#define ld long double
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll count=0;
        while(n>0)
        {
            count+=n;
            //cout<<count<<"\n";
            n/=2;
        }
        cout<<count<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        double n;
        cin>>n;
        ll count=0;
        while(n>0)
        {
            count+=n;
            n=n/2;
        }
        cout<<count<<"\n";
    }
}


#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin>>t;
    while(t--)
    {
        double n;
        cin>>n;
        ll count=0;
        while(n>0)
        {
            count+=n;
            n=n/2;
        }
        cout<<count<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[0]=1;
	for(int k=1;k<=61;k++)
		a[k]=pow(2,k+1)-1;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		int i=0;
		while(pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=pow(2,j))
			{
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[0]=1;
	for(int k=1;k<=62;k++)
		a[k]=pow(2,k+1)-1;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		int i=0;
		while(pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=pow(2,j))
			{
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[0]=1;
	for(int k=1;k<=63;k++)
		a[k]=1+2*a[k-1];
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		int i=0;
		while(pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=pow(2,j))
			{
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[0]=1;
	for(int k=1;k<=61;k++)
		a[k]=(ll)pow(2,k+1)-1;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		int i=0;
		while((ll)pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=(ll)pow(2,j))
			{
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[1]=1;
	for(int k=2;k<=62;k++)
		a[k]=k+2*a[k-1];
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		if(n==1)
		{
			cout<<1<<"\n";
			continue;
		}
		n++;
		a[1]=1;
		int i=2;
		while((ll)pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=1;j--)
		{
			if(n>=(ll)pow(2,j))
			{
				if(n>(ll)pow(2,j))
					ans+=j+1;
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		if(n==1)
		{
			cout<<1<<"\n";
			continue;
		}
		n++;
		a[0]=0;
		a[1]=1;
		int i=2;
		while(pow(2,i)<=n)
		{
			a[i]=i+2*a[i-1];
			i++;
		}
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=pow(2,j))
			{
				if(n>pow(2,j))
					ans+=j+1;
				n-=(ll)pow(2,j);
				ans+=a[j];

			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		if(n==1)
		{
			cout<<1<<"\n";
			continue;
		}
		n++;
		a[1]=1;
		int i=2;
		while(pow(2,i)<=n)
		{
			a[i]=i+2*a[i-1];
			i++;
		}
		i--;
		for(int j=i;j>=1;j--)
		{
			if(n>=pow(2,j))
			{
				if(n>pow(2,j))
					ans+=j+1;
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[0]=1;
	a[1]=3;
	for(int k=2;k<=62;k++)
		a[k]=1+2*a[k-1];
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		int i=0;
		while(pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=0;j--)
		{
			if(n>=pow(2,j))
			{
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	a[1]=1;
	for(int k=2;k<=62;k++)
		a[k]=k+2*a[k-1];
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		if(n==1)
		{
			cout<<1<<"\n";
			continue;
		}
		n++;
		a[1]=1;
		int i=2;
		while(pow(2,i)<=n)
			i++;
		i--;
		for(int j=i;j>=1;j--)
		{
			if(n>=pow(2,j))
			{
				if(n>pow(2,j))
					ans+=j+1;
				n-=pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll n,ans=0;
		cin>>n;
		if(n==1)
		{
			cout<<1<<"\n";
			continue;
		}
		n++;
		a[0]=0;
		a[1]=1;
		int i=2;
		while(pow(2,i)<=n)
		{
			a[i]=i+2*a[i-1];
			i++;
		}
		i--;
		for(int j=i;j>=1;j--)
		{
			if(n>=pow(2,j))
			{
				if(n>pow(2,j))
					ans+=j+1;
				n-=(ll)pow(2,j);
				ans+=a[j];
			}
		}
		cout<<ans<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;

int main ()
{
    int t;

     long long dp[61];
        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       long long ans = 0;
       while(n!=0)
       {

        long long k = log2(n);
        long long f = pow(2,k);
        long long d = (n-f);
        ans+= (dp[k]+k+1);
        n=d;
       }
       cout << ans << endl;

    }
     for(int i = 0;i<61;i++){
            dp[i] = 0;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[61];

int main ()
{
    int t;

        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       long long ans = 0;
       int r = log2(n);
       unsigned long long m = 1;
       while(n!=0)
       {

        while(n<(m<<r))r--;
        long long f = m<<r;
        long long d = (n-f);
        ans+= (dp[r]+r+1);
        n=d;
        r--;
       }
       cout << ans << endl;

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[61];
long long solve(long long n){
    if(n==1)return 1;
    if(n==0)return 0;
    else{
        long long ans = 0;
        long long k = log2(n);
        long long d = (n-pow(2,k));
        return (dp[k]+k+1+solve(d));
    }
}

int main ()
{
    int t;

    dp[0]=0;
    dp[1]=1;
    for(int i = 2;i<61;i++){
        dp[i] = dp[i-1]+i+dp[i-1];
    }

    cin >> t;
    while (t--)
    {
       long long n;
       cin >> n;
       cout << solve(n) << endl;

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long solve(long long n,long long dp[]){
    if(n==1)return 1;
    if(n==0)return 0;
    else{
        long long ans = 0;
        long long k = log2(n);
        long long f = pow(2,k);
        long long d = (n-f);
        return (dp[k]+k+1+solve(d,dp));
    }
}

int main ()
{
    int t;

     long long dp[61];
        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
    cin >> t;
    while (t--)
    {

       long long n;
       cin >> n;
       cout << solve(n,dp) << endl;

    }
     for(int i = 0;i<61;i++){
            dp[i] = 0;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long solve(long long n,long long dp[]){
    if(n==1)return 1;
    if(n==0)return 0;
    else{
        long long ans = 0;
        long long k = log2(n);
        long long f = pow(2,k);
        long long d = (n-f);
        return (dp[k]+k+1+solve(d,dp));
    }
}

int main ()
{
    int t;

    cin >> t;
    while (t--)
    {
         long long dp[61];
        dp[0]=0;
        dp[1]=1;
        for(int i = 2;i<61;i++){
            dp[i] = dp[i-1]+i+dp[i-1];
        }
       long long n;
       cin >> n;
       cout << solve(n,dp) << endl;

    }
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
int cnt=3;
int t;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    memset(sum,0,sizeof(sum));
    memset(delta,0,sizeof(delta));
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((1ll<<cnt)<1000000000000000000){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if((int)n%2){
			    r+=sum[pos];
			}
			pos++;
			n/=2;
		}
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
ll cnt=3,r=8;
int t;
ll k=1000000000000000000;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    memset(sum,0,sizeof(sum));
    memset(delta,0,sizeof(delta));
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	//cout<<sum[cnt]<<endl;
    	cnt++;
    	r<<=1;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2){
			    r+=sum[pos];
			}
			pos++;
			n/=2;
		}
		//cout<<s<<endl;
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
//关闭流同步就不能手写读入优化啦
int cnt=3;
int t;
ll mul=1;
ll n;
ll sum[1000];//表示每一位里包含的差异值
ll delta[1000];
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    rep(i,0,64){
    	sum[i]=mul*2-1;
    	mul*=2;
    	//cout<<i<<" "<<sum[i]<<endl;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		string s;
		while(n){
			if(n%2){
			    r+=sum[pos];
			}
			s+=(char('0'+n%2));
			pos++;
			n/=2;
		}
		//cout<<s<<endl;
		//cout<<endl;
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
int cnt=3;
ll r=8;
int t;
ll k=1000000000000000000;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    memset(sum,0,sizeof(sum));
    memset(delta,0,sizeof(delta));
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	//cout<<sum[cnt]<<endl;
    	cnt++;
    	r<<=1;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2){
			    r+=sum[pos];
			}
			pos++;
			n/=2;
		}
		//cout<<s<<endl;
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
ll cnt=3,r=8;
int t;
ll k=1e18;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
    	r<<=1;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2)
			r+=sum[pos];
			pos++;
			n/=2;
		}
		//cout<<s<<endl;

		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
ll cnt=1,r=8;
int t;
ll k=1e18;
ll n;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
    	r<<=1;
	}
	cin>>t;
	while(t--){
		cin>>n;
		string s;
		ll r=0;
		int pos=0;
		while(n){
			if(n%2)
			r+=sum[pos];
			pos++;
			n/=2;
		}
		//cout<<s<<endl;

		cout<<r<<endl;
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
ll cnt=1,r=8;
int t;
ll k=1e18;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
    	r<<=1;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2)
			r+=sum[pos];
			pos++;
			n/=2;
		}
		//cout<<s<<endl;

		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
//关闭流同步就不能手写读入优化啦
int cnt=3;
int t;
ll k=8;
ll n;
ll sum[1000];//表示每一位里包含的差异值
ll delta[1000];
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    sum[0]=1ll;sum[1]=1ll*3,sum[2]=1ll*7;
    delta[0]=1ll,delta[1]=1ll*3,delta[2]=1ll*4;
    while((k<<1)<1000000000000000000){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
    	k<<=1;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2){
			    r+=sum[pos];
			}
			pos++;
			n/=2;
		}
		//cout<<endl;
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
int cnt=3;
int t;
ll k=1000000000000000000;
ll n;
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0),cout.tie(0);
    memset(sum,0,sizeof(sum));
    memset(delta,0,sizeof(delta));
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((1ll<<cnt)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	//cout<<sum[cnt]<<endl;
    	cnt++;
	}
	scanf("%d",&t);
	while(t--){
		scanf("%lld",&n);
		ll r=0;
		int pos=0;
		while(n){
			if(n%2){
			    r+=sum[pos];
			}
			pos++;
			n/=2;
		}
		//cout<<s<<endl;
		printf("%lld\n",r);
	}
    return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eps 1e-8
#define all(v) (v.begin(),v.end())
#define db double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const double pi=acos(-1.0);
const double inf = 1e100;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll sum[32];//表示每一位里包含的差异值
ll delta[32];
ll cnt=1,r=8;
int t;
ll k=1e18;
ll n;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    sum[0]=1;sum[1]=3,sum[2]=7;
    delta[0]=1,delta[1]=3,delta[2]=4;
    while((r<<1)<k){
    	sum[cnt]=sum[cnt-1]+delta[cnt-1]*2;
    	delta[cnt]=2*delta[cnt-1];
    	cnt++;
    	r<<=1;
	}
	cin>>t;
	while(t--){
		cin>>n;
		string s;
		while(n){
			s+=char('0'+n%2);
			n/=2;
		}
		//cout<<s<<endl;
		ll r=0;
		rep(i,0,s.size()){
			if(s[i]=='1'){
				r+=sum[i];
			}
		}
		cout<<r<<endl;
	}
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int N = 1050;

typedef long long ll;

ll poww(ll x,ll y)
{
    //cout <<"poww()   --"<<endl;
    ll ans = 1;
    while(y)
    {
        // cout << x<<" "<<y<<endl;
        if(y&1) ans *= x;
        y >>= 1;
        x *= x;
    }
    return ans ;
}

ll n;
ll a[100];
void solve()
{
    cin >> n;
    ll ans = 0;
    for(int i=60;n > 0;i --)
    {
        if(poww(2,i) <= n)
        {
            n -= poww(2,i);
            ans += a[i] + i + 1;
        }
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >>t;

    a[1] = 1;
    for(int i=2; i<=61; i++)
        a[i] =  a[i-1]*2 + i;
    while(t--)
    {
        solve();
    };
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

ll n;
void solve()
{
    cin >> n;
    ll ans = 0;
    while(n)
    {
        ans += n;
        n >>= 1;
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >>t;

    while(t--)
    {
        solve();
    };
}


#include<bits/stdc++.h>
using namespace std;

const int N = 1050;

typedef long long ll;

ll poww(ll x,ll y)
{
    //cout <<"poww()   --"<<endl;
    ll ans = 1;
    while(y)
    {
        // cout << x<<" "<<y<<endl;
        if(y&1) ans *= x;
        y >>= 1;
        x *= x;
    }
    return ans ;
}

ll n;
ll a[100];
void solve()
{
    cin >> n;
    ll ans = 0;
    while(n)
    {
        ans += n;
        n >>= 1;
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >>t;

    a[1] = 1;
    for(int i=2; i<=61; i++)
        a[i] =  a[i-1]*2 + i;
    while(t--)
    {
        solve();
    };
}


#include<bits/stdc++.h>
using namespace std;

const int N = 1050;

typedef long long ll;

ll poww(ll x,ll y)
{
    ll ans = 1;
    while(y)
    {
        if(y&1) ans *= x;
        y >>= 1;
        x *= x;
    }
    return ans ;
}

ll n;
ll a[100];
void solve()
{
    cin >> n;
    ll ans = 0;
    for(int i=60;n > 0;i --)
        if(poww(2,i) <= n)
        {
            n -= poww(2,i);
            ans += a[i] + i + 1;
        }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >>t;

    a[1] = 1;
    for(int i=2; i<=61; i++)
        a[i] =  a[i-1]*2 + i;
    while(t--)
        solve();
}


#include<bits/stdc++.h>
using namespace std;

const int N = 1050;

typedef long long ll;

ll n;
ll a[100];
void solve()
{
    cin >> n;
    ll ans = 0;
    for(int i=60;n > 0;i --)
        if(poww(2,i) <= n)
        {
            n -= poww(2,i);
            ans += a[i] + i + 1;
        }

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >>t;

    a[1] = 1;
    for(int i=2; i<=61; i++)
        a[i] =  a[i-1]*2 + i;
    while(t--)
    {
        solve();
    };
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i/2]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0,i=0;
    while(n>0)
    {
        if(n%2==1)
            ans+=dp[pow(2,i)];
        i++;
        n/=2;
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i>>1]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0;
    if(dp[n]!=0){
        cout<<dp[n]<<"\n";return;}

    long temp=n;
    int i=0;
    while(temp>0)
    {
        if(temp%2==1)
            ans+=dp[pow(2,i)];
        i++;
        temp/=2;
    }
    dp[n]=ans;
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i>>1]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0;
    if(dp[n]!=0){
        cout<<dp[n]<<"\n";return;}

    long temp=n;
    int i=0;
    while(temp>0)
    {
        if(temp%2==1)
            ans+=dp[pow(2,i)];
        i++;
        temp/=2;
    }
    dp[n]=ans;
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<ll,ll> dp;
ll n;
void preprocess()
{
    dp[1]=1;
    for(ll i=2;i<=(1e18+5);i=i*2)
    {
        dp[i]=dp[i/2]*2+1;
    }
}
void solve()
{
    cin>>n;
    ll ans=0,i=0;
    while(n>0)
    {
        if(n%2==1)
            ans+=dp[pow(2,i)];
        i++;
        n/=2;
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i/2]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0,i=0;
    while(n>0)
    {
        if(n%2==1)
            ans+=dp[pow(2,i)];
        i++;
        n/=2;
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i>>1]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0,i=0;
    while(n>0)
    {
        if(n%2==1)
            ans+=dp[pow(2,i)];
        i++;
        n/=2;
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll t;
	cin >> t;

	map<ll, ll> mp;
	mp[1] = 1;
	for (ll i = 2; i <= 1e18 + 10; i = i * 2) {
		mp[i] = mp[i / 2] * 2 + 1;
	}

	while (t--) {

		ll n;
		cin >> n;

		ll ans = 0;
		ll i = 0;
		while (n > 0) {
			if (n % 2 == 1) {
				ans += mp[pow(2, i)];
			}
			i++;
			n = n / 2;
		}

		cout << ans << "\n";
	}

	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<long,long> dp;
long n;
void preprocess()
{
    dp[1]=1;
    for(long i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i>>1]*2+1;
    }
}
void solve()
{
    cin>>n;
    long ans=0;
    if(dp[n]!=0){
        cout<<dp[n]<<"\n";return;}

    long temp=n;
    int i=0;
    while(temp>0)
    {
        int bit=temp&1;
        if(bit)
            ans+=dp[pow(2,i)];
        i++;
        temp>>=1;
    }
    dp[n]=ans;
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define N 2e5+5
#define f first
#define s second
#define all(x) x.begin(),x.end()
//#define int long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define fore(i,l,r) for(int i=l;i<r;i++)
#define sz(a) (int)((a).size())
#define ll long long
#define ar array
#define init(arr) memset(arr,0,sizeof(arr))

map<ll,ll> dp;
ll n;
void preprocess()
{
    dp[1]=1;
    for(ll i=2;i<=(1e18);i*=2)
    {
        dp[i]=dp[i/2]*2+1;
    }
}
void solve()
{
    cin>>n;
    ll ans=0,i=0;
    while(n>0)
    {
        if(n%2==1)
            ans+=dp[pow(2,i)];
        i++;
        n/=2;
    }
    cout<<ans<<"\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    cin>>t;
    preprocess();
    while(t--)
    solve();
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        long long n;
        cin>>n;
        long long nb = floor(log(n)/log(2))+1;
        long long res=0;
        for(long long i=0; i<nb; i++)
        {
            long long one=1;
            if((one<<i)&n)
            {
                res+=(2*(one<<(i))-1);
            }
        }
        cout<<res<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        long long n;
        cin>>n;
        string s="12";
        int i=3;
        while(s.length()<n)
        {
            s=s+to_string(1)+to_string(i)+s;
            //cout<<s<<endl;
            i++;
        }
        long long res=0;
        for(long long i=0; i<n; i++)
            res+=(s[i]-'0');
        cout<<res<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        long long n;
        cin>>n;
        long long nb = floor(log(n)/log(2))+1;
        long long res=0;
        for(long long i=0; i<nb+1; i++)
        {
            long long one=1;
            if((one<<i)&n)
            {
                res+=(2*(one<<(i))-1);
            }
        }
        cout<<res<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        long long n;
        cin>>n;
        long long nb = floor(log(n)/log(2))+1;
        long long res=0;
        for(long long i=0; i<nb; i++)
        {
            long long one=1;
            if((one<<i)&n)
            {
                res+=(2*pow(2, i)-1);
            }
        }
        cout<<res<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long fun(long long n)
{
    long long high=0;
    while(n>0)
    {
        n=n&(n-1);
        high++;
    }
    return high;
}
int main()
{
    long long t;
    cin>>t;
    while(t--)
    {
        long long n;
        cin>>n;
        long long res=0;
        for(long long i=1; i<=n; i++)
        {
            res+=fun((i-1)^i);
        }
        cout<<res<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[56];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,56){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        REP(i,1,56)if(pow(2,i)>n || i==55){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(n==n%(ll)pow(2,i-1))break;
          break;
        }
        if(n==1)break;
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      //n=M;
      ll ans=0;
      ll dp[61];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,61){
        dp[i]=dp[i-1]*2+1;
      }
      //cout<<1e18<<endl;
      //while(n>1){ans+=1;n/=2;}
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        ll flag=0;
        REP(i,1,61)if(pow(2,i)>n || i==60){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(flag==1)break;
          if(n==1 && i==1){flag=1;}
          break;
        }
        if(flag==1)break;
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[55];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,55){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        if(n==1){ans++;break;}
        REP(i,0,55)if(pow(2,i)>n || i==54){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          break;
        }
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[55];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,55){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        if(n==1){ans++;break;}
        REP(i,2,55)if(pow(2,i)>n || i==54){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          break;
        }
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[56];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,56){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        ll flag=0;
        REP(i,1,56)if(pow(2,i)>n || i==55){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(flag==1)break;
          if(n==1 && i==1){flag=1;}
          break;
        }
        if(flag==1)break;
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[56];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,56){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        REP(i,1,56)if(pow(2,i)>n || i==54){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(n==n%(ll)pow(2,i-1))break;
          break;
        }
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[55];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,55){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        REP(i,1,55)if(pow(2,i)>n || i==54){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(n==n%(ll)pow(2,i-1))break;
          break;
        }
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      ll ans=0;
      ll dp[56];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,56){
        dp[i]=dp[i-1]*2+1;
      }
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        REP(i,1,56)if(pow(2,i)>n || i==55){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(n==n%(ll)pow(2,i-1))break;
          break;
        }
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h> //C
using namespace std;

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000000000000000

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"
#define ff first
#define ss second

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define take(arr,n) REP(i,0,n)cin>>arr[i];
#define print(arr, n) REP(i,0,n)cout<<arr[i]<<" ";
#define printv(v) REP(i,0,v.size())cout<<v[i]<<" ";

ll gcd(ll a, ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}

ll lcm(ll a, ll b){
  return a*b/gcd(a,b);
}

int main() {
    fast
    ll t;
    cin>>t;
    //t=1;
    while(t--){
      ll n;
      cin>>n;
      //n=M;
      ll ans=0;
      ll dp[60];
      dp[0]=1;
      dp[1]=3;
      //dp[2]=4;
      REP(i,2,60){
        dp[i]=dp[i-1]*2+1;
      }
      //cout<<1e18<<endl;
      //while(n>1){ans+=1;n/=2;}
      //ll ans=0;
      //cout<<dp[18]<<endl;
      if(n==1)ans=1;
      else{
      while(n>=1){
        ll flag=0;
        REP(i,1,60)if(pow(2,i)>n || i==59){
          ans+=dp[i-1];
          n=n%(ll)pow(2,i-1);
          if(flag==1)break;
          if(n==1 && i==1){flag=1;}
          break;
        }
        if(flag==1)break;
      }
    }
      cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        cout<<2*n-__builtin_popcount(n)<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        cout<<2*n-__builtin_popcount(n)<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = n - 1; i>= 0; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<ll> vll;
const int MAXN = 100005;
ll mod=1000000007;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t,n,m;
	cin>>t;
	rep(z,t){
        cin>>n;
        ll x=0,num=n;
        while(num>0){
            if(num%2==1) x++;
            num/=2;
        }
        cout<<2*n-x<<nl;
	}
	return 0;
}


#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = n - 1; i>= 0; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<ll> vll;
const int MAXN = 100005;
ll mod=1000000007;

ll solve(ll n){
    if(n==1) return 1;
    long double base=log2(n);
    ll b=floor(base);
    if(b==base){
        return (pow(2,b+1)-1);
    }
    ll k=pow(2,b);
    ll cnt=k*2-1;
    ll mid=(k/2)*3;
    //cout<<cnt<<" "<<mid<<nl;
    if(n<=mid){
        return cnt+solve(n-k);
    }
    return cnt+solve(mid-k)+solve(n-mid);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t,n,m;
	cin>>t;
	rep(z,t){
        cin>>n;
        cout<<solve(n)<<nl;
	}
	return 0;
}


def main():
    a=[0]*10
    n=int(input())
    s=input()
    for i in range(n):
        if s[i]=="L":
            a[a.index(0)]=1
        elif s[i]=="R":
            a[9-a[::-1].index(0)]=1
        else:
            a[int(s[i])]=0
    print(''.join(map(str,a)))
main()


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T>
void debug(T var, string label){
    cout << label << " = " << var << '\n';
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] == 'L'){
            for(int j = 9; j >= 0; --j){
                if((ans & (1 << j)) == 0){
                    ans |= (1 << j);
                    break;
                }
            }
        }
        else if(s[i] == 'R'){
            for(int j = 0; j < 10; ++j){
                if((ans & (1 << j)) == 0){
                    ans |= (1 << j);
                    break;
                }
            }
        }
        else {
            int pos = 9 - s[i] + '0';
            ans &= ~(1 << pos);
        }
    }
    cout << bitset<10>(ans).to_string() << '\n';
}
//printf("%.5f\n", clock() / (float)CLOCKS_PER_SEC); time in seconds


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <limits>
#include <random>
#include <chrono>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T>
void debug(T var, string label){
    cout << label << " = " << var << '\n';
}

int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    string s;
    cin >> n >> s;
    bitset<10> bs;
    for(int i = 0; i < s.size(); ++i){
        if(s[i] == 'L'){
            for(int j = 9; j >= 0; --j){
                if(bs[j] == 0){
                    bs[j] = 1;
                    break;
                }
            }
        }
        else if(s[i] == 'R'){
            for(int j = 0; j < 10; ++j){
                if(bs[j] == 0){
                    bs[j] = 1;
                    break;
                }
            }
        }
        else {
            bs[9 - s[i] + '0'] = 0;
        }
    }
    cout << bs << '\n';
}


def hotel(string):
    values=['0']*10
    i=0
    j=len(values)-1
    index=0
    while index<len(string):
        if string[index]=='L' and values[index]=='0':
            values[i]='1'
            i=i+1
        elif string[index]=='R' and values[index]=='0':
            values[j]='1'
            j=j-1
        elif string[index].isdigit() and values[int(string[index])]=='1':
            values[int(string[index])]='0'
            if i>int(string[index]):
                i=int(string[index])
            else:
                j=int(string[index])

        index=index+1
    return ''.join(values)
n=int(input())
string=input()
print(hotel(string))


def hotel(string):
    values=['0']*10
    i=0
    j=len(values)-1
    index=0
    while index<len(string):
        if string[index]=='L':
            values[i]='1'
            i=i+1
        elif string[index]=='R':
            values[j]='1'
            j=j-1
        elif string[index].isdigit():
            values[int(string[index])]='0'
            i=int(string[index])
        index=index+1
    return ''.join(values)
n=int(input())
string=input()
print(hotel(string))


def hotel(string):
    values=['0']*10
    for i in range(len(string)):
        if string[i]=='L':
            for i in range(len(values)):
                if values[i]=='0':
                    values[i]='1'
                    break
        elif string[i]=='R':
            for j in range(len(values)-1,-1,-1):
                if values[j]=='0':
                    values[j]='1'
                    break
        elif int(string[i])>=0 and int(string[i])<=9:
            values[int(string[i])]='0'
    return ''.join(values)
n=int(input())
string=input()
print(hotel(string))


'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input().rstrip()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
# mod=1000000007
mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file = 1

def solve():

    # for _ in range(ii()):

    n = ii()
    s = si()
    ans = ['0']*10
    for i in range(n):
        if s[i] == 'L':
            for j in range(10):
                if ans[j]=='0':
                    ans[j] = '1'
                    break
        elif(s[i]=='R'):
            for j in range(9,-1,-1):
                if ans[j]=='0':
                    ans[j] = '1'
                    break
        else:
            ans[int(s[i])] = '0'

    print(''.join(ans))

if __name__ =="__main__":

    if(file):

        if path.exists('input.txt'):
            sys.stdin=open('input.txt', 'r')
            sys.stdout=open('output.txt','w')
        else:
            input=sys.stdin.readline
    solve()


'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input().rstrip()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
# mod=1000000007
mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file = 1

def solve():

    # for _ in range(ii()):

    n = ii()
    s = si()
    ans = ['0']*10
    for i in range(n):
        if s[i] == 'L':
            for j in range(10):
                if ans[j]=='0':
                    ans[j] = '1'
                    break
        elif(s[i]=='R'):
            for j in range(9,-1,-1):
                if ans[j]=='0':
                    ans[j] = '1'
                    break
        else:
            ans[int(i)] = '0'
    print(''.join(ans))

if __name__ =="__main__":

    if(file):

        if path.exists('input.txt'):
            sys.stdin=open('input.txt', 'r')
            sys.stdout=open('output.txt','w')
        else:
            input=sys.stdin.readline
    solve()


n = int(input())
log = input()
left = 0
right = 9
hotel = [0] * 10
for l in log:
    if l == 'L':
        for i in range(10):
            if hotel[i] == 0:
                left = i
                break
        hotel[left] = 1
    elif l == 'R':
        for i in range(9, -1, -1):
            if hotel[i] == 0:
                right = i
                break
        hotel[right] = 1
    else:
        pos = int(l)
        hotel[pos] = 0
print(''.join(map(str, hotel)))


n = int(input())
log = input()
left = 0
right = 9
hotel = [0] * 10
for l in log:
    if l == 'L':
        hotel[left] = 1
        while hotel[left] == 1:
            left += 1
    elif l == 'R':
        hotel[right] = 1
        while hotel[right] == 1:
            right -= 1
    else:
        pos = int(l)
        hotel[pos] = 0
        if pos < left:
            left = pos
        if pos > right:
            right = pos
print(''.join(map(str, hotel)))


n = int(input())
log = input()
left = 0
right = 9
hotel = [0] * 10
for l in log:
    if l == 'L':
        for i in range(9):
            if hotel[i] == 0:
                left = i
                break
        hotel[left] = 1
    elif l == 'R':
        for i in range(9, -1, -1):
            if hotel[i] == 0:
                right = i
                break
        hotel[right] = 1
    else:
        pos = int(l)
        hotel[pos] = 0
print(''.join(map(str, hotel)))


n = int(input())
s = input()
ans = list("0"*10)
for i in s:
    if(i == 'L'):
        for j in range(10):
            if(ans[j] == '0'):
                ans[j] = '1'
                break
    elif i == 'R':
        for j in range(9, -1, -1):
            if(ans[j] == '0'):
                ans[j] = '1'
                break
    else:
        ans[int(i)] = '0'
for i in ans:
    print(i, end="")
print()


def convert(list):

    # Converting integer list to string list
    # and joining the list using join()
    res = ''.join([str(i) for i in list])

    return res

n=int(input())
events=input()
rooms=[0]*10

for e in events:
    if(e=='L'):
        index=rooms.index(0)
        rooms[index]=1
    elif(e=='R'):
        index=''.join(map(str,rooms)).rindex('0')
        rooms[index]=1
    else:
        rooms[int(e)]=0

print(convert(rooms))


def convert(list):

    # Converting integer list to string list
    # and joining the list using join()
    res = int("".join(map(str, list)))

    return res

n=int(input())
events=input()
rooms=[0]*10

for e in events:
    if(e=='L'):
        for i in range(0,10):
            if(rooms[i]==0):
                rooms[i]=1
                break
    elif(e=='R'):
        for i in range(9,-1,-1):
            if(rooms[i]==0):
                rooms[i]=1
                break
    else:
        rooms[int(e)]=0

print(convert(rooms))


n=int(input())
ch=input()
b=[0]*10
for e in ch:
    if e=='L':
        i=b.index(0)
        b[i]=1
    elif e=='R':
        b.reverse()
        i=b.index(0)
        b[i]=1
        b.reverse()
    else:
        b[int(e)]=0
print(b)


n=int(input())
ch=input()
b=[0]*10
for e in ch:
    if e=='L':
        i=b.index(0)
        b[i]=1
    elif e=='R':
        b.reverse()
        i=b.index(0)
        b[i]=1
        b.reverse()
    else:
        b[int(e)]=0
ch=''
for e in range(10):
    ch+=str(b[e])
print(ch)


n = int(input())
s = input()
k = [0,0,0,0,0,0,0,0,0,0]
for i in range(n):
  if s[i] == 'L':
    for j in range(10):
      if k[j] != 1:
        k[j] = 1
        break
  elif s[i] == 'R':
    for j in range(9, -1, -1):
      if k[j] != 1:
        k[j] = 1
        break
  elif int(s[i]) >= 0 and i <= 9:
    k[int(s[i])] = 0
for i in k:
  print(i, end='')


n = int(input())
s = input()
k = [0,0,0,0,0,0,0,0,0,0]
for i in range(n):
  if s[i] == 'L':
    for j in range(10):
      if k[j] != 1:
        k[j] = 1
        break
  elif s[i] == 'R':
    for j in range(9, -1, -1):
      if k[j] != 1:
        k[j] = 1
        break
  else:
    k[int(s[i])] = 0
for i in k:
  print(i, end='')


import sys
import os

def changeStdioToFile():
    path = os.path.dirname(os.path.abspath(__file__))
    sys.stdin = open(f'{path}/input.txt', 'r')
    sys.stdout = open(f'{path}/output.txt', 'w')

#changeStdioToFile()
t = 1
for _ in range(t):
	n = int(input())
	orders = input()
	rooms = ['0'] * 10
	for c in orders:
		if c == 'L':
			rooms[rooms.index('0')] = '1'
		elif c == 'R':
			rooms[9 - rooms[::-1].index('0')] = '1'
		else:
			rooms[int(c)] = '0'
	print(''.join(rooms))


def main():
    n = int(input())
    arr = [0 for _ in range(10)]
    s = input()
    for c in s:
        if c == "L":
            i = 0
            while i < n and arr[i] == 1:
                i += 1
            arr[i] = 1
        elif c == "R":
            i = 9
            while i >= 0 and arr[i] == 1:
                i -= 1
            arr[i] = 1
        else:
            arr[int(c)] = 0
    for i in arr:
        print(i, end="")
    print("")

# for _ in range(int(input())):
#     main()
main()


n = int(input())
Rooms = ['0' for i in range(10)]
allot = input()
left = 0
right = 9

for char in allot:
    if char == 'L':
        for i in range(0, 10):
            if Rooms[i] == '0':
                Rooms[i] = '1'
                break
    elif char == 'R':
        for i in range(9, -1, -1):
            if Rooms[i] == '0':
                Rooms[i] = '1'
                break
    else:
        Rooms[int(char)] = '0'

print("".join(Rooms))


n=int(input())
s=input()
li=[0 for i in range(10)]
for i in s:
	if i=='L':
		for j in range(10):
			if li[j]==0:
				li[j]=1
				break
	elif i=='R':
		for j in range(9,-1,-1):
			if li[j]==0:
				li[j]=1
				break
	else:
		d = int(i)
		li[d]=0

for i in range(10):
	print(li[i],end="")


# author : sudoer
n = int(input())
a = [i for i in input()]
l = ['0'] * 10
# print (a)
for i in range(n):
	if a[i] == 'L':
		for j in range(0,10):
			if l[j] == '0':
				l[j] = '1'
				break
	elif a[i] == 'R':
		for j in range(9,-1,-1):
			if l[j] == '0':
				l[j] = '1'
				break
	else:
		val  = int(a[i])
		l[val] = '0'

for i in range(10):
	print (l[i] , end = " ")
print ()


# author : sudoer
n = int(input())
a = [i for i in input()]
l = ['0'] * 10
# print (a)
for i in range(n):
	if a[i] == 'L':
		for j in range(0,10):
			if l[j] == '0':
				l[j] = '1'
				break
	elif a[i] == 'R':
		for j in range(9,-1,-1):
			if l[j] == '0':
				l[j] = '1'
				break
	else:
		val  = int(a[i])
		l[val] = '0'

for i in range(10):
	print (l[i] , end = "")
print ()


n = int(input())
s = input()
rms = [0] * 10
a = ''

for i in s:
    if i == 'R':
        for y in range(9,-1,-1):
            if rms[y] == 0:
                rms[y] = 1
                break

    elif i == 'L':
        for z in range(10):
            if rms[z] == 0:
                rms[z] = 1
                break

    else:
        rms[int(i)] = 0

for p in rms:
    a += str(p)

print(a)


# def get_input(inp):
#   li = inp.split("\n")
#
#   def inner():
#     return li.pop(0)
#   return inner
#
# INPUT="""9
# L0L0LLRR9
# """
# input = get_input(INPUT)

# import sys
# input = sys.stdin.readline

def main():
  n = int(input())
  s = input().strip()
  room = ['0' for _ in range(10)]
  for _s in s:
    if _s == 'L':
      for j in range(10):
        if room[j] == '0':
          room[j] = '1'
          break
    elif _s == 'R':
      for j in range(9, -1, -1):
        if room[j] == '0':
          room[j] = '1'
          break
    else:
      i = int(_s)
      room[i] = '0'
  print(''.join(room))

if __name__ == '__main__':
  main()


def get_input(inp):
  li = inp.split("\n")

  def inner():
    return li.pop(0)
  return inner

INPUT="""9
L0L0LLRR9
"""
input = get_input(INPUT)

# import sys
# input = sys.stdin.readline

def main():
  n = int(input())
  s = input().strip()
  room = ['0' for _ in range(10)]
  for _s in s:
    if _s == 'L':
      for j in range(10):
        if room[j] == '0':
          room[j] = '1'
          break
    elif _s == 'R':
      for j in range(9, -1, -1):
        if room[j] == '0':
          room[j] = '1'
          break
    else:
      i = int(_s)
      room[i] = '0'
  print(''.join(room))

if __name__ == '__main__':
  main()


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(5):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(5):
            if(b[9-j]==0):
                b[9-j]=1
                break
    else:
        b[int(a[i])]=0
for i in range(10):
    print(b[i],end='')


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(5):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(5):
            if(b[9-j]==0):
                b[j]=1
                break
    else:
        b[int(a[i])]=0
for i in range(10):
    print(b[i],end='')


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(5):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(9,4,-1):
            if(b[j]==0):
                b[j]=1
                break
    else:
        b[int(a[i])]=0
for i in range(10):
    print(b[i],end='')


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(5):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(5):
            if(b[n-1-j]==0):
                b[j]=1
                break
    else:
        b[int(a[i])]=0
for i in range(10):
    print(b[i],end='')


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(10):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(10):
            if(b[9-j]==0):
                b[9-j]=1
                break
    else:
        b[int(a[i])]=0
for i in range(10):
    print(b[i],end='')


n=int(input())
a=input()
b=[0]*10
for i in range(n):
    if(a[i]=='L'):
        for j in range(5):
            if(b[j]==0):
                b[j]=1
                break
    elif(a[i]=='R'):
        for j in range(9,4,-1):
            if(b[j]==0):
                b[j]=1
                break
    else:
        b[int(a[i])]=0
    print(*b)
for i in range(10):
    print(b[i],end='')


n=int(input())
s=input()
l=[0]*10
i=0
while(i<len(s)):
    if(ord(s[i])>=48 and ord(s[i])<=57):
        l[ord(s[i])-48]=0
    elif(s[i]=='L'):
        for j in range(0,10):
            if(l[j]==0):
                l[j]=1
                break
    else:
        for j in range(9,-1,-1):
            if(l[j]==0):
                l[j]=1
                break
    i+=1

for k in l:
    print(k,end=" ")


n=int(input())
s=input()
l=[0]*10
i=0
while(i<len(s)):
    if(ord(s[i])>=48 and ord(s[i])<=57):
        l[ord(s[i])-48]=0
    elif(s[i]=='L'):
        for j in range(0,10):
            if(l[j]==0):
                l[j]=1
                break
    else:
        for j in range(9,-1,-1):
            if(l[j]==0):
                l[j]=1
                break
    i+=1

q=""
for i in l:
    q=q+str(i)
print(q)


events = int(input())
str = input()
arr = [0]*10
for i in str:
  if i=='L':
    for j in range(0,10):
      if arr[j]==0:
        arr[j]=1
        break
  elif i=='R':
    for j in range(9,-1,-1):
      if arr[j]==0:
        arr[j]=1
        break
  else:
    arr[int(i)]=0
for i in arr:
  print(i,end='')


n = int(input())
s = input()
left = 0
right = 9
rooms = [False]*10
for i in s:
	if i=='L':
		rooms[left]=True
		for z in range(left,10):
			if rooms[z]==False:
				left=z
				break;
	elif i=='R':
		rooms[right]=True
		for z in range(right,0,-1):
			if rooms[z]==False:
				right=z
				break;
	else:
		x = int(i)
		rooms[x]=False
		if(x<left):
			left=x
		if(x>right):
			right=x
for i in range(0,10):
	print(int(rooms[i]),end="")


n = int(input())
s = input()
left = 0
right = 9
rooms = [False]*10
for i in s:
	if i=='L':
		for x in range(0,10):
			if(rooms[x]==False):
				rooms[x]=True
				break
	elif i=='R':
		for x in range(9,-1,-1):
			if(rooms[x]==False):
				rooms[x]=True
				break
	else:
		rooms[int(i)]=False
for i in range(0,10):
	print(int(rooms[i]),end="")


#r = open('inp.txt', 'r')
s = input()
s = input()
#r.close()
rooms = [0 for i in range(10)]

for i in s:
	if i == "L":
		for n in range(10):
			if rooms[n] == 0:
				 rooms[n] = 1
				 break
	elif i == "R":
		for n in range(1, 11):
			if rooms[-n] == 0:
				 rooms[-n] = 1
				 break
	else:
		rooms[int(i)] = 0

#o = open('out.txt', 'w')
for i in rooms:
	print(i, end="")
#o.close()


#r = open('inp.txt', 'r')
s = input()
s = input()
#r.close()
rooms = [0 for i in range(10)]

for i in s:
	if i == "L":
		for n in range(10):
			if rooms[n] == 0:
				 rooms[n] = 1
				 break
	elif i == "R":
		for n in range(1, 10):
			if rooms[-n] == 0:
				 rooms[-n] = 1
				 break
	else:
		rooms[int(i)] = 0

#o = open('out.txt', 'w')
for i in rooms:
	print(i, end="")
#o.close()


n = int(input())
l = list(input().strip())

room = [0 for a in range(0,10)]

for i in l:
	if i == 'L':
		for j in range(0,10):
			if room[ j] == 0:
				room[j] = 1
				break
	elif i == 'R':
		for j in range(-1, -11, -1):
			if room[ j] == 0:
				room[j] = 1
				break
	else:
		room[int(i)] = 0
print("".join(str(x) for x in room))


n = int(input())
s = input()
r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for i in range(n):
    if s[i] == "L":
        for i in range(10):
            if r[i] == 0:
                r[i] = 1
                break
    elif s[i] == "R":
        for i in range(9, -1, -1):
            if r[i] == 0:
                r[i] = 1
                break
    else:
        r[int(s[i])] = 0
for i in r: print(i, end = "")


n=int(input())
s=input()
a=[0,0,0,0,0,0,0,0,0,0]
for i in range(n):
    if s[i]=='L':
        a[a.index(0)]=1
    elif s[i]=='R':
        a.reverse()
        a[a.index(0)]=1
        a.reverse()
    else:
        a[int(s[i])]=0
for i in a:
    print(i,end='')


n=int(input())
s=input()
a=[0,0,0,0,0,0,0,0,0,0]
for i in range(n):
    if s[i]=='L':
        a[a.index(0)]=1
    elif s[i]=='R':
        a.reverse()
        a[a.index(0)]=1
        a.reverse()
    else:
        a[int(s[i])]=0
for i in a:
    print(i,end=' ')


n = int(input())
s=input()
lis=[0]*10
l=0
r=n-1
for i in range(n):
    if s[i]=='L':
        for j in range(10):
            if lis[j]==0:
                lis[j]=1
                break
    elif s[i]=='R':
        for j in range(9,-1,-1):
            if lis[j]==0:
                lis[j]=1
                break
    else:
        lis[int(s[i])]=0
print(*lis)


n = int(input())
s=input()
lis=[0]*10
l=0
r=n-1
for i in range(n):
    if s[i]=='L':
        for j in range(10):
            if lis[j]==0:
                lis[j]=1
                break
    elif s[i]=='R':
        for j in range(9,-1,-1):
            if lis[j]==0:
                lis[j]=1
                break
    else:
        lis[int(s[i])]=0
print(*lis,sep='')


# import heapq
def solve():
    n = int(input())
    rooms = [0] * 10
    assignments = input()
    # left_rooms = list(range(10))
    # left_rooms = [(v, v) for v in left_rooms]
    # heapq.heapify(left_rooms) # min-heap

    # right_rooms = list(range(10))
    # right_rooms = [(-v, v) for v in right_rooms]
    # heapq.heapify(right_rooms) # max-heap
    for a in assignments:
        if a == 'L':
            for i in range(10):
                if rooms[i] == 0:
                    rooms[i] = 1
                    break
            # room = heapq.heappop(left_rooms)[1]
            # rooms[room] = 1
        elif a == 'R':
            for i in reversed(range(10)):
                if rooms[i] == 0:
                    rooms[i] = 1
                    break
            # room = heapq.heappop(right_rooms)[1]
            # rooms[room] = 1
        else:
            rooms[int(a)] = 0
            # room = int(a)
            # rooms[room] = 0
            # heapq.heappush(left_rooms, (room, room))
            # heapq.heappush(right_rooms, (-room, room))
    print(''.join(map(str, rooms)))

def main():
    solve()

if __name__ == '__main__':
    main()


n=int(input())
str1=input()
rooms=[0]*10
for i in str1:
    if(i=='L'):
        for i in range(10):
            if rooms[i]== 0:
                rooms[i]=1
                break
    elif(i=='R'):
        for i in range(9,0,-1):
            if rooms[i]== 0:
                rooms[i]=1
                break
    else:
        index=int(i)
        rooms[index]=0
str2=""
for i in rooms:
    str2+=str(i)
print(str2)


n=int(input())
str1=input()
rooms=[0]*10
for i in str1:
    if(i=='L'):
        for i in range(10):
            if rooms[i]== 0:
                rooms[i]=1
                break
    elif(i=='R'):
        for i in range(9,-1,-1):
            if rooms[i]== 0:
                rooms[i]=1
                break
    else:
        index=int(i)
        rooms[index]=0
str2=""
for i in rooms:
    str2+=str(i)
print(str2)


n = int(input())
entry = input()
rooms = [0]*10

for letter in entry:
    if letter == 'L':
        for i in range(10):
            if rooms[i] == 0:
                rooms[i] = 1
                break
    elif letter == 'R':
        for i in range(9, -1, -1):
            if rooms[i] == 0:
                rooms[i] = 1
                break
    else:
        rooms[int(letter)] = 0

print(*rooms, sep = '')


n=int(input())
a=[0 for i in range(10)]
s=input()
for i in s:
    if(i=='L'):
        for j in range(10):
            if(a[j]==0):
                a[j]=1
                break
    elif(i=='R'):
        for j in range(9,0,-1):
            if(a[j]==0):
                a[j]=1
                break
    else:
        x=int(i)
        a[x]=0
ans=""
for i in a:
    ans+=str(i)
print(ans)


n=int(input())
a=[0 for i in range(10)]
s=input()
for i in s:
    if(i=='L'):
        for j in range(10):
            if(a[j]==0):
                a[j]=1
                break
    elif(i=='R'):
        for j in range(9,-1,-1):
            if(a[j]==0):
                a[j]=1
                break
    else:
        x=int(i)
        a[x]=0
ans=""
for i in a:
    ans+=str(i)
print(ans)


n = int(input())

s = input()

arr = [0]*10

for i in s:
	if i == 'L':
		ind = arr.index(0)
		arr[ind] = 1
	elif i == 'R':
		ind = arr[::-1].index(0)
		arr[9 - ind] = 1
	else:
		arr[int(i)] = 0

print(*arr,sep=' ')


n = int(input())

s = input().lower()

arr = [0 for i in range(0,10)]

for i in s:
	if i == 'l':
		ind = arr.index(0)
		arr[ind] = 1
	elif i == 'r':
		ind = arr[::-1].index(0)
		ind = 10 - (ind+1)
		arr[ind] = 1
	else:
		ind = int(i)
		arr[ind] = 0

for i in arr:
	print(str(i),end=' ')
print()


n = int(input())

s = input().lower()

arr = [0 for i in range(0,10)]

for i in s:
	if i == 'l':
		ind = arr.index(0)
		arr[ind] = 1
	elif i == 'r':
		ind = arr[::-1].index(0)
		ind = 10 - (ind+1)
		arr[ind] = 1
	else:
		ind = int(i)
		arr[ind] = 0

print(*arr,sep=' ')


n = int(input())
s = input()
arr = [0]*10
for i in s:
	if i == 'L':
		arr[arr.index(0)] = 1
	elif i == 'R':
		arr[9-arr[::-1].index(0)] = 1
	else:
		arr[int(i)] = 0
print(*arr,sep='')


room = [0] * 10
for ch in input():
    if ch == 'L':
        room[room.index(0)] = 1
    elif ch == 'R':
        room[room[::-1].index(0)] = 1
    else:
        room[int(ch)] = 0
print(*room, seq='')


room = [0] * 10
c = int(input())
for ch in input():
    if ch == 'L':
        room[room.index(0)] = 1
    elif ch == 'R':
        room[9 - room[::-1].index(0)] = 1
    else:
        room[int(ch)] = 0
print(*room, sep='')


n=int(input())
s=input()
li=[0 for i in range(10)]
for i in s:
	if i=='L':
		for j in range(10):
			if li[j]==0:
				li[j]=1
				break
	elif i=='R':
		for j in range(9,-1,-1):
			if li[j]==0:
				li[j]=1
				break
	else:
		d = int(i)
		li[d]=0

for i in range(10):
	print(li[i],end="")


a=int(input())
b=str(input())
c=[0]*10
for k in b:
    if k=="L":
        c[c.index(0)]=1
    elif k=="R":
        c.reverse()
        c[c.index(0)]=1
        c.reverse()
    else:
        c[int(k)]=0
s=""
for k in c:
    s+=str(k)
print(s)


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1e9+1
#define inf1 1e15+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
ll int st[800005],a[200005],lazy[800005];
void init(int i,int l,int r){
	if(l==r){st[i]=a[l];return ;}
	init(2*i+1,l,mid(l,r));
	init(2*i+2,mid(l,r)+1,r);
	st[i]=min(st[2*i+1],st[2*i+2]);
}
void updaterange(int i,int l,int r,int l1,int r1,ll int val){
	if(l>r1||r<l1)return;
	st[i]+=lazy[i];
	if(l!=r){
		lazy[2*i+1]+=lazy[i];
		lazy[2*i+2]+=lazy[i];
	}
	lazy[i]=0;
	if(l1<=l&&r<=r1){
		st[i]+=val;
		if(l!=r){
			lazy[2*i+1]+=val;
			lazy[2*i+2]+=val;
		}
		return;
	}
	updaterange(2*i+1,l,mid(l,r),l1,r1,val);
	updaterange(2*i+2,mid(l,r)+1,r,l1,r1,val);
	st[i]=min(st[2*i+1],st[2*i+2]);
}
int query(int i,int l,int r){
	st[i]+=lazy[i];
	if(l==r)return l;
	if(l!=r){
		lazy[2*i+1]+=lazy[i];
		lazy[2*i+2]+=lazy[i];
	}
	lazy[i]=0;
	if(st[2*i+2]+lazy[2*i+2]==0)return query(2*i+2,mid(l,r)+1,r);
	else return query(2*i+1,l,mid(l,r));
}
void solve(){
	int n;
	cin>>n;
	rep(i,n)cin>>a[i];
	init(0,0,n-1);
	int ans[n];
	for(int i=0;i<n;i++){
		int pos=query(0,0,n-1);
		ans[pos]=i+1;
		updaterange(0,0,n-1,pos+1,n-1,-i-1);
		updaterange(0,0,n-1,pos,pos,inf1);
	}
	for(int i=0;i<n;i++)cout<<ans[i]<<" ";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define ll long long
#define F first
#define S second
#define val F.F
#define ind F.S
#define lazy S
const int MX=2e5;
int N;
pair<pair<ll, int>, ll> st[MX*4];
ll arr[MX];
int an[MX];
void merge(int p) {
    if(st[p<<1|1].val <= st[p<<1].val) {
        st[p]=st[p<<1|1];
    }
    else {
        st[p]=st[p<<1];
    }
}
void push(int L, int R, int p) {
    if(st[p].lazy == 0) return ;
    st[p].val+=st[p].lazy;
    if(L != R) {
        st[p<<1].lazy += st[p].lazy;
        st[p<<1|1].lazy += st[p].lazy;
    }
    st[p].lazy=0;
}
void build(int L, int R, int p) {
    if(L == R) {
        st[p]=mk(mk(arr[L], L), 0);
        return ;
    }
    int mid=L+R >> 1;
    build(L, mid, p<<1);
    build(mid+1, R, p<<1|1);
    merge(p);
}
void update(int L, int R, int p, int i, int j, ll v) {
    push(L, R, p);
    if(L > R || L > j || R < i) return ;
    if(L >= i && R <= j) {
        st[p].lazy=v;
        push(L, R, p);
        return ;
    }
    int mid=L+R >> 1;
    update(L, mid, p<<1, i, j, v);
    update(mid+1, R, p<<1|1, i, j, v);
    merge(p);
}
pair<ll, int> Q(int L, int R, int p, int i, int j) {
    push(L, R, p);
    if(L > R || L > j || R < i) {
        return mk(2e18, 0);
    }
    if(L >= i && R <= j) {
        return mk(st[p].val, st[p].ind);
    }
    int mid=L+R >> 1;
    pair<ll, int> c1=Q(L, mid, p<<1, i, j);
    pair<ll, int> c2=Q(mid+1, R, p<<1|1, i, j);
    if(c2.F <= c1.F) {
        return c2;
    }
    return c1;
}
void solve()
{
    scanf("%d", &N);
    for(int i=0;i<N;i++) {
        scanf("%lld", &arr[i]);
    }
    build(0, N-1, 1);
    int cur=1;
    for(int i=0;i<N;i++) {
        pair<ll, int> G=Q(0, N-1, 1, 0, N-1);
        an[G.S]=cur;
        update(0, N-1, 1, G.S, G.S, 1e18);
        update(0, N-1, 1, G.S, N-1, -cur);
        ++cur;
    }
    for(int i=0;i<N;i++) {
        cout<<an[i]<<" ";
    }
}
int main()
{
    int T=1;
//    cin>>T;
    while(T--) solve();
    return 0;
}

// freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);