#include #include #include using namespace std; int n, a[10001]; int main() { cin >> n; for (int i = 0; i < n; i++) { unsigned int c; cin >> c; unsigned int m = 1 << 31; int pos = 0; for (int j = 0; j < 32; j++) { unsigned int res = m&c; if (res == m) { pos = j; break; } m >>= 1; } pos = 31 - pos; unsigned int count = 0; while (c) { c &= (c - 1); count++; } unsigned int r=0; for (int j = 0; j <= pos; j++) { if (count != 0) { r = r << 1; r = r | 1; count--; } else { r = r << 1; } } cout << r<<" "; } return 0; }