#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n;
int cnt[35], tmp[35];
long long num[N + 3];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &num[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 31; j++)
      if (num[i] >> j & 1) cnt[j]++, tmp[j] = i;
  int mx = 0;
  for (int i = 31; i >= 0; i--)
    if (cnt[i] == 1) {
      printf("%lld ", num[tmp[i]]);
      mx = tmp[i];
      break;
    }
  for (int i = 1; i <= n; i++)
    if (i != mx) printf("%d ", num[i]);
  printf("\n");
  return 0;
}
