#include <bits/stdc++.h>
using namespace std;
int v[100010], cnt[50];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &v[i]);
    for (int bit = 0; bit <= 32; bit++)
      if (v[i] & (1 << bit)) cnt[bit]++;
  }
  int mx = 0, pz = 1;
  for (int i = 1; i <= n; i++) {
    int s = 0;
    for (int bit = 0; bit <= 32; bit++)
      if (v[i] & (1 << bit) && cnt[bit] == 1) s |= (1 << bit);
    if (s > mx) {
      mx = s;
      pz = i;
    }
  }
  printf("%d ", v[pz]);
  for (int i = 1; i <= n; i++)
    if (i != pz) printf("%d ", v[i]);
  return 0;
}
