#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int N,X;
    cin>>N>>X;
    vector<int> A(0);
    int count=0;
    rep(i,N){
        int tmp;
        cin>>tmp;
        if(tmp!=X){
            A.push_back(tmp);
            count++;
        }
    }
    rep(i,A.size()){
        cout<<A.at(i)<<" ";
    }
    cout<<endl;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
#define GETA 200

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(n, N) {
        cin >> A[n];
    }
    ll ans = 1<<30;
    rep(pt, 1 << (N-1)) {
        ll XOr = 0;
        ll now = 0;
        rep(n, N) {
            //全てA[n]基準
            now |= A[n];
            if ((pt >> n) & 1) {
                //その数字の右側で区切り
                XOr ^= now;
                now = 0;
            }
        }
        XOr ^= now;
        ans = min(ans, XOr);
    }
    cout << ans << endl;
}