#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod1 = (int)1e9 + 7, mod2 = (int)998244353;
const int INF = (int)1e9;
const int di[8] = {1, 0, -1, 0, 1, 1, -1, -1}, dj[8] = {0, 1, 0, -1, -1, 1, -1, 1};

#define rep0(i, n) for (i = 0; i < n; i++)
#define rep1(i, a, b) for (i = a; i < b; i++)


int main(void){
    int i, j, k;
    int n, a[23];

    cin >> n;
    rep0(i, n){
        cin >> a[i];
    }

    int ans;
    int bit, val, s;
    ans = (1<<31) - 1;
    rep0(bit, (1<<(n-1))){
        val = 0;
        s = a[0];
        rep0(i, n - 1){
            if ((bit>>i) % 2 == 1){
                val ^= s;
                s = 0;
            }
            s |= a[i + 1];
        }
        val ^= s;
        ans = min(ans, val);
    }

    cout << ans << endl;

    return (0);
};
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long int 
#define lp(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pi 3.14159265358979323846
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
 
int main() 
{
    fastio
    ll s1,p;
    cin>>s1>>p;
    set<ll> s;
    lp(i,1,sqrt(p)+1)
    {
        if(p%i==0)
        {
            if(p/i==i) s.insert(i);
            else {s.insert(p/i); s.insert(i);}
        }
    }
    ll cnt=0;
    for(auto itr= s.begin();itr!=s.end();itr++) 
    {
        ll x=*itr, y=p/(*itr);
        if(x+y==s1) {cnt=1; cout<<"Yes"; break;}
    }
    if(cnt==0) cout<<"No";
}