#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n], cnt[30] = {0};
  long long val = 0, first = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    bitset<32> t(a[i]);
    for (long long j = 0; j < 31; j++) cnt[j] += t[j];
  }
  for (long long i = 0; i < n; i++) {
    bitset<32> t(a[i]);
    long long cur = 0;
    for (long long j = 0; j < 31; j++) cnt[j] -= t[j];
    for (long long j = 0; j < 31; j++)
      if (t[j] && !cnt[j]) cur += (1ll << j);
    if (cur > val) val = cur, first = i;
    for (long long j = 0; j < 31; j++) cnt[j] += t[j];
  }
  cout << a[first] << ' ';
  for (long long i = 0; i < n; i++)
    if (i != first) cout << a[i] << ' ';
  return 0;
}
