#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5 + 10;
long long a[maxn], cnt[50];
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    for (int j = 0; j <= 31; j++)
      if ((a[i] >> j) & 1) cnt[j]++;
  }
  for (long long i = 31; i >= 0; i--) {
    if (cnt[i] == 1) {
      int pos = 0;
      for (long long j = 1; j <= n; j++)
        if ((a[j] >> i) & 1) pos = j;
      printf("%lld ", a[pos]);
      for (int j = 1; j < pos; j++) printf("%lld ", a[j]);
      for (int j = pos + 1; j <= n; j++) printf("%lld ", a[j]);
      return;
    }
  }
  for (long long i = 1; i <= n; i++) printf("%lld ", a[i]);
}
int main() {
  solve();
  return 0;
}
