#include <bits/stdc++.h>
using namespace std;
int solve(int a[], int n) {
  int idx = 0;
  for (int i = 30; i >= 0; i--) {
    int cnt = 0;
    for (int j = 0; j < n; j++)
      if (a[j] & (1 << i)) {
        cnt++;
        idx = j;
      }
    if (cnt == 1) break;
  }
  return idx;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int idx = solve(a, n);
  cout << a[idx] << " ";
  for (int i = 0; i < n; i++)
    if (i != idx) cout << a[i] << " ";
  return 0;
}
