#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>
#include <fstream>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

const int MAXN = 510000;
const int MOD = 1000000007;

long long fac[MAXN], finv[MAXN], inv[MAXN];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAXN; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {

    ll N;
    cin >> N;
    ll kosuu = 0;
    ll M = sqrt(N);


    if (M * M == N) {
        rpt(i, 1, M) {
            if (N % i == 0 && i % 2 == 1) {
                ++kosuu;
            }
            if (N % i == 0 && (N / i) % 2 == 1) {
                ++kosuu;
            }
        }
        if (M % 2 == 1) {
            ++kosuu;
        }
    }
    else {
        rpt(i, 1, M + 1) {
            if (N % i == 0 && i % 2 == 1) {
                ++kosuu;
            }
            if (N % i == 0 && (N / i) % 2 == 1) {
                ++kosuu;
            }
        }
    }
    cout << 2 * kosuu << endl;
}
#include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    for(auto &i :a) cin >> i;
    int ans = 2000000000;
    for(int i=0; i < 1 << (N-1);i++){
        int xored = 0;
        int ored = 0;
        for(int j=0;j<N;j++){
            ored |= a[j];
            if(i>>j & 1) xored^=ored, ored=0;
        }
        xored^=ored;
        ans = min(ans,xored);
    }
    
    cout << ans << endl;
}