#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int a[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans;
  for (int i = 30; i >= 0; i--) {
    int flag = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) {
        flag++;
        ans = j;
      }
    }
    if (flag == 1) {
      break;
    }
  }
  cout << a[ans] << " ";
  for (int i = 0; i < n; i++) {
    if (i != ans) {
      cout << a[i] << " ";
    }
  }
  cout << endl;
  return 0;
}
