#include <bits/stdc++.h>
using namespace std;
const long long N = 111111;
long long n, a[N];
bool used[N];
vector<long long> res;
signed main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long bit = 30; bit >= 0; bit--) {
    long long i = 0, c = 0;
    for (long long j = 0; j < n; ++j) {
      if (a[j] & (1ll << bit)) {
        c++;
        i = j;
      }
    }
    if (c != 1) continue;
    cout << a[i] << ' ';
    for (long long j = 0; j < n; ++j)
      if (j != i) cout << a[j] << ' ';
    return 0;
  }
  for (long long i = 0; i < n; ++i) cout << a[i] << ' ';
}
