#include <bits/stdc++.h>
int a[100001];
int b[32];
int main() {
  int n, i, j;
  for (j = 0; j < 32; j++) b[j] = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int c = a[i];
    for (j = 0; j < 32; j++) {
      if (c % 2 == 1) {
        if (b[j] == 0)
          b[j] = i;
        else
          b[j] = -1;
      }
      c = c / 2;
    }
  }
  for (j = 31; j >= 0; j--)
    if (b[j] > 0) break;
  if (j >= 0) {
    printf("%d", a[b[j]]);
    for (i = 1; i < b[j]; i++) printf(" %d", a[i]);
    for (i = b[j] + 1; i <= n; i++) printf(" %d", a[i]);
    printf("\n");
  } else {
    for (i = 1; i < n; i++) printf("%d ", a[i]);
    printf("%d\n", a[n]);
  }
  return 0;
}
