#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, -1};
long long int m, n, a[500050], bit[50] = {0};
int k;
string s1 = "one", s2 = "zero", ch = "", s;
set<long long int> st;
set<long long int> st1;
vector<pair<long long int, long long int> > vv, vv2, vm;
vector<pair<long long int, pair<long long int, long long int> > > vvv, vvv2;
vector<long long int> v, v1;
map<long long int, long long int> mp;
long long int f(long long int x, long long int y) { return ((x | y) - y); }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int i = 0, x, y, j = 0, z, q, nb0 = 0, nbp = 0, nbn = 0, nbmax = 0,
                nbinf = 0, mm = 5e8, idx = 0, ok = 0, l, r, negatif = 0,
                positif = 0, l1, r1, t, d;
  set<long long int>::iterator it;
  char c;
  cin >> n;
  long long int nb = 0;
  long long int res = -1;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    for (j = 0; j <= 30; j++)
      if (a[i] & (1LL << j)) bit[j]++;
  }
  idx = 1;
  for (i = 1; i <= n; i++) {
    x = a[i];
    long long int cur = 0;
    for (j = 0; j <= 30; j++) {
      if (x & (1 << j) && bit[j] == 1) cur += (1 << j);
    }
    if (cur > res) {
      res = cur;
      idx = i;
    }
  }
  cout << a[idx] << " ";
  for (i = 1; i <= n; i++)
    if (i != idx) cout << a[i] << " ";
  return 0;
}
