#include using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; for (int h = 1; h <= n; h++) { int x; cin >> x; int rem = 2; vector ones,zeros; for (int c = 30; c >= 0; c--) { if (((1<= 0; j--) { if ((1<= max(0,(int)ones.size() - 2) && i < min(2,(int)zeros.size()); j--,i++) { if (ones[j] < zeros[i]) x -= 1<<(ones[j]), x += 1<