#include <bits/stdc++.h>
int T;
int n;
int a[300010];
int cnt[32], id[32];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    int bas = 30;
    while (bas >= 0) {
      if ((1 << bas) & a[i]) cnt[bas]++, id[bas] = i;
      bas--;
    }
  }
  int pos = -1;
  for (int i = 30; i >= 0; i--) {
    if (cnt[i] == 1) {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    for (int i = 1; i <= n; i++) printf("%d ", a[i]);
    return 0;
  }
  pos = id[pos];
  printf("%d ", a[pos]);
  for (int i = 1; i <= n; i++) {
    if (i == pos) continue;
    printf("%d ", a[i]);
  }
  return 0;
}
