#include <bits/stdc++.h>   using namespace std;   const int MAX = 500005;   long long a[MAX], pre[MAX], suf[MAX], t;   int main() {     int ans = -1, pos = 0, n;     scanf( %d , &n);     for (register int i = 1; i <= n; i++) {       scanf( %lld , &a[i]);       pre[i] = pre[i - 1] | a[i];     }     for (register int i = n; i >= 1; i--) suf[i] = suf[i + 1] | a[i];     for (register int i = 1; i <= n; i++) {       t = pre[i - 1] | suf[i + 1];       if ((a[i] | t) - t > ans) {         ans = (a[i] | t) - t;         pos = i;       }     }     printf( %lld  , a[pos]);     for (register int i = 1; i <= n; i++)       if (i != pos) printf( %lld  , a[i]);     return 0;   }   