#include using namespace std; typedef long long LL; const int nmax = 200010; const LL mod = 1000000007; int N,v[nmax]; int main(void){ LL i,j,urm,x,cnt,w; // freopen("txt.in","r",stdin); // freopen("txt.out","w",stdout); // ios::sync_with_stdio(false); cin >> N; while(N--){ cin >> x; cnt = w = 0; v[0] = 0; int j = -1; while(x){ v[++v[0]] = x%2; if(j<0&& x%2) j = v[0]; x/=2; } for(i = v[0]; i != j; --i) if(!v[i]){ v[i] = 1; v[j] = 0; break; } LL p = 0; for(i = v[0]; i; --i) p=p*2LL+v[i]; cout << p << ' '; } return 0; }