#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
const int MAXPOWER = 1 << 29;
int n, cnt, ind;
int ary[MAXN];
int order[MAXN];
void read();
void calc();
void count(int);
void print();
int main() {
  read();
  calc();
  print();
  return 0;
}
void read() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ary[i];
}
void calc() {
  int m = MAXPOWER;
  bool found = false;
  while (m > 0) {
    count(m);
    if (cnt == 1) {
      order[0] = ary[ind];
      found = true;
      break;
    }
    m >>= 1;
  }
  if (!found) {
    for (int i = 0; i < n; i++) order[i] = ary[i];
  } else {
    int j = 1;
    for (int i = 0; i < n; i++)
      if (i != ind) order[j++] = ary[i];
  }
}
void count(int power) {
  cnt = 0;
  for (int i = 0; i < n; i++) {
    if ((ary[i] & power) != 0) {
      ind = i;
      cnt++;
    }
  }
}
void print() {
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << ' ';
    cout << order[i];
  }
  cout << endl;
}
