#include <bits/stdc++.h>
const long long mod = 998244353;
using namespace std;
long long n, q, a[40][100001], kol, ind, b[100001], x, k;
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    b[i] = x;
    q = 0;
    while (x > 0) {
      a[q][i] = x % 2;
      x /= 2;
      q++;
    }
  }
  for (long long r = 39; r >= 0; r--) {
    k = 0;
    for (long long i = 0; i < n; i++) {
      k += a[r][i];
      if (a[r][i] == 1) ind = i;
    }
    if (k == 1) break;
  }
  cout << b[ind] << " ";
  for (long long i = 0; i < n; i++) {
    if (i == ind) continue;
    cout << b[i] << " ";
  }
  return 0;
}
