#include #include #include using namespace std; typedef long long LL; typedef unsigned long long ULL; const LL INF = 1E9+9; LL Lee[100]; void pre() { LL cur=1; for(LL i=1,j=0;j<64;i<<=1,j++) { Lee[j]=cur; cur=cur*2+i; } } LL cal(LL x) { for(LL i=1,j=0;;i<<=1,j++) { if(i==x) { return Lee[j]; } } return 0; } int main() { pre(); int nCase; LL m,i,j,k,n; scanf("%d",&nCase); while(nCase--) { scanf("%I64d",&m); LL cur=1; LL ans=0; LL i; for(i=1;m>=i;i<<=1) { ans+=cur; cur=cur*2+i; m-=i; } LL cnt=i; LL f=1; while(m>0) { if(m