#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int emm[31];
bool b[100005][31];
int flag;
int main() {
  scanf("%d", &n);
  emm[0] = 1;
  for (int i = 1; i <= 30; i++) emm[i] = emm[i - 1] * 2;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int x = a[i];
    for (int j = 30; j >= 0; j--) {
      if (x >= emm[j]) {
        x -= emm[j];
        b[i][j] = 1;
      }
    }
  }
  for (int i = 30; i >= 0; i--) {
    flag = 0;
    for (int j = 1; j <= n; j++) {
      if (b[j][i]) flag++;
    }
    if (flag == 1) {
      for (int j = 1; j <= n; j++)
        if (b[j][i]) {
          printf("%d ", a[j]);
          for (int k = 1; k <= n; k++)
            if (k != j) printf("%d ", a[k]);
          printf("\n");
          return 0;
        }
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
