#include using namespace std; int bit[35]; int main() { // ifstream fin("home.in"); // ofstream fout("home.out"); int n,i,x,j1, j2; cin>>n; for(i = 1;i <= n;i++){ cin>>x; int c = 0; int ax = x; while(ax){ ++c; if(ax&1){ bit[c] = 1; } ax >>= 1; } for(j1 = 1;j1 <= c;j1++){ if(bit[j1] == 1){ break; } } for(j2 = c - 1;j2 >= 1;j2--){ if(bit[j2] == 0){ break; } } if(j1 == c + 1 || j2 == 0 || j1 >= j2){ cout<= 1;j1--){ bst *= 2; bst += bit[j1]; } cout<