#include<bits/stdc++.h>
using namespace std;
/*Uzumaki Naruto
  Mesut Ozil
  Harry Potter*/

using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define HarryPotter ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define MAX 100000000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;} 



void Ojas(){
	
	ll n;
	cin>>n;
	ll ar[n];
	for(ll i=0;i<n;i++){
		cin>>ar[i];
	}
	ll mini = LLONG_MAX;
	for(ll i=0;i<pow(2,n);i++){
		ll *nar = new ll[n]();
		ll temp = i,j=0,prev_bit=temp%2;
		
		ll num = ar[j],curr=0;
		while(temp){
			if(temp%2==1){
				nar[j] = 1;
			}
			j++;
			temp = temp>>1;
		}
		j = 0;
		
		while(j<n){
			if(nar[j]==prev_bit){
				num = num|ar[j];
			}else{
				prev_bit = 1-prev_bit;
				curr = curr^num;
				num = ar[j];
			}
			j++;
		}
		
		mini = min(mini,curr^num);
	}
	cout<<mini;
}


int main(){
  
  int t=1;
  //cin>>t;
  for(int i=1;i<=t;++i){
  	Ojas();
  }
  
  return 0;
}
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
  int n, a[1000];
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a, a + n);
  for(int i = 1; i <= n; i++){
    if(i != a[i - 1]){
      cout << "No" << endl;
      break;
    }
    if(i == n){
      cout << "Yes" << endl;
    }
  }
  return 0;
}