#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	ll N; cin >> N;
	ll* A = new ll[N];
	ll m = 0;
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		sum = sum ^ A[i];
		m = m | A[i];
	}

	ll filter = m - sum;

	set<ll, greater<ll>> st;
	for (int i = 0; i < N; i++) {
		ll a = A[i] & filter;
		for (auto itr = st.begin(); itr != st.end(); itr++) {
			a = min(a, a ^ *itr);
		}
		if (a != 0) {
			st.insert(a);
		}
	}

	ll s = filter;
	for (auto itr = st.begin(); itr != st.end(); itr++) {
		s = min(s, (s ^ *itr) & filter);
	}
	cout << sum + (filter - s) * 2 << endl;

	return 0;
}

#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = int(1e5) + 2;
const int inf = (int)1e15;

int n, a[N], sumxor, basis[N];

void Ins(int x) {
    for(int i = 59; i >= 0; --i) {
        if(!(x >> i & 1)) continue;
        if(basis[i] == 0) {
           basis[i] = x; return;
        }
        x ^= basis[i];
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        sumxor ^= a[i];
    }
    for(int i = 1; i <= n; ++i) {
        for(int j = 0; j < 60; ++j)
            if(sumxor & a[i] & (1ll << j)) a[i] ^= (1ll << j);
        Ins(a[i]);
    }
    int ans = 0;
    for(int i = 59; i >= 0; --i) {
        if(!basis[i]) continue;
        if(ans >> i & 1) continue;
        ans ^= basis[i];
    }
    cout << ans * 2  + sumxor;
}
