#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[200000];
  int b[200000];
  for (int i = 0; i < int(200000); i++) {
    a[i] = 0;
    b[i] = 0;
  }
  int n, k;
  int x, y, z;
  scanf("%d", &n);
  for (int i = 0; i < int(n); i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  z = 0;
  for (int ii = 0; ii < int(31); ii++) {
    x = 0;
    for (int i = 0; i < int(n); i++) {
      if (a[i] % 2 == 1) {
        x++;
        y = i;
      }
      a[i] /= 2;
    }
    if (x == 1) z = y;
  }
  printf("%d", b[z]);
  for (int i = 0; i < int(n); i++) {
    if (i != z) printf(" %d", b[i]);
  }
  printf("\n");
  return 0;
}
