#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e5 + 5;
const int MAXL = 1e5 + 7;
const int mod = 1e9 + 7;
int n;
int arr[maxn];
int vis[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    for (int j = 0; j <= 30; j++) {
      if (arr[i] & (1 << j)) vis[j]++;
    }
  }
  int pos = -1;
  int mmax = -1;
  for (int i = 1; i <= n; i++) {
    for (int j = 30; j >= 0; j--) {
      if (vis[j] == 1 && (arr[i] & (1 << j)) && j > mmax) {
        pos = i;
        mmax = j;
        break;
      }
    }
  }
  if (pos != -1) printf("%d ", arr[pos]);
  for (int i = 1; i <= n; i++) {
    if (i != pos) printf("%d ", arr[i]);
  }
  puts("");
}
