#include <bits/stdc++.h>
using namespace std;
//for randomization
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
#define int long long
#define double long double
#define big __int128_t
#define ulong unsigned long long
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define pb push_back
#define endl '\n'
#define all(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod = 998244353;
const int N = 1e6+5;
const int INF = 1e18;
void solve(){
int n; cin>>n;
vector<int> a(n);
for(int & i:a) cin>>i;
int ans = INF;
for(int i = 0;i<(1<<(n-1));i++){
int xorr= 0, orr = 0;
for(int j = 0;j<=n;j++){
if(j<n) orr|= a[j];
if(j==n || (i>>j&1)){
xorr^=orr;
orr = 0;
}
}
ans = min(ans,xorr);
}
cout<<ans<<endl;
}
signed main()
{
fastio;
//freopen("closing.in", "r", stdin);
//freopen("closing.out", "w", stdout);
int T =1;
// cin>>T;
while(T--){
solve();
}
}
// tahir
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |