#include <bits/stdc++.h>
using namespace std;
int n;
int a[100009], b[33];
void sovle(int j) {
  swap(a[1], a[j]);
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  exit(0);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 32; i >= 1; i--) {
    for (int j = 1; j <= n; j++)
      if (a[j] & (1 << (i - 1))) b[i]++;
  }
  for (int i = 32; i >= 1; i--) {
    if (b[i] != 1) continue;
    for (int j = 1; j <= n; j++)
      if (a[j] & (1 << (i - 1))) sovle(j);
  }
  sovle(1);
}
