#include <bits/stdc++.h>
long long int MOD = 1000000007;
using namespace std;
map<long long int, long long int> m;
string decToBinary(int n) {
  string ans;
  for (int i = 31; i >= 0; i--) {
    int k = n >> i;
    if (k & 1)
      ans += '1';
    else
      ans += '0';
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int t;
  t = 1;
  while (t--) {
    long long int n, el;
    cin >> n;
    vector<string> els;
    vector<long long int> inels;
    for (long long int i = 0; i < n; i++) {
      cin >> el;
      inels.push_back(el);
      els.push_back(decToBinary(el));
    }
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < 32; j++) {
        if (els[i][j] == '1') {
          m[j]++;
        }
      }
    }
    bool found = false;
    long long int a = 0;
    for (auto &x : m) {
      if (x.second == 1) {
        a = x.first;
        found = true;
        break;
      }
    }
    if (found) {
      for (long long int i = 0; i < n; i++) {
        if (els[i][a] == '1') {
          a = i;
          break;
        }
      }
      cout << inels[a] << ' ';
      for (auto &x : inels) {
        if (x != inels[a]) cout << x << ' ';
      }
    } else {
      for (auto &x : inels) {
        cout << x << ' ';
      }
    }
  }
}
