#include <bits/stdc++.h>
using namespace std;

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    ll s = 0;
    rep(i, N) s ^= a[i];
    ll ans = s;
    rep(i, N) {
      // s で１が立っていたビットを強制的にa[i]を0にビットを変換（考慮しない）
      a[i] &= ~s;
    }
    int r = 0;
    vector<int> top(N);
    for (int i = 60; i >= 0; i--) {
      int j = r;
      for (; j < N; j++) {
        if (a[j] >> i & 1) {
          swap(a[r], a[j]);
          break;
        }
      }
      if (j == N) continue;
      top[r] = i;
      rep(k, N) {
        if (r == k) continue;
        if (a[k] >> i & 1) a[k] ^= a[r];
      }
      r++;
    }
      
    ll x = 0;
    for (int i = 60; i >= 0; i--) {
      ll nx = x | (1ll << i);
      ll b = nx;
      rep(j, r) {
        if (b >> top[j] & 1) b ^= a[j];
      }
      if ((b & nx) == 0) {
        x = nx;
      }
    }
    ans += x * 2;
    cout << ans << endl;
    return 0;

}
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}





///////////////////////////

ll p(ll n) {
	if (n == 0) { return 1; }
	return 2 * p(n - 1);
}


int main() {

	ll N;
	cin >> N;

	vector<ll> A(N + 1);

	repn(i, N) cin >> A[i];

	sort(++A.begin(), A.end(), greater<ll>());

	vector<vector<ll>> d(N + 1,vector<ll>(60));

	vector<ll> count1(60);

	repn(i, N) {
		ll t = A[i];
		rep(j,60){
			d[i][59-j] = t%2;
			count1[59-j]+= d[i][59-j];
			t /= 2;
		}
	}
	
	repn(i, N) {
		rep(j, 60) {
			if (count1[j] % 2 == 1) { d[i][j] = 0; }
		}
	}

	/*
	repn(i, N) {
		rep(j, 60) {
			cout << d[i][j];
		}
		cout << endl;
	}
	*/


	repn(i, N) {
		ll K=-1;
		rep(j,60){
			if (d[i][j] == 1) { K = j; break; }
		}

		//cout << i << K << endl;

		if (K == -1) { continue; }

		repn(l, N) {
			if (l == i) { continue; }

			if (d[l][K] == 1) {
				for (int j = K; j < 60; j++) {
					d[l][j] = (d[i][j] + d[l][j]) % 2;
				}
			}
		}

		/*
		repn(i, N) {
			rep(j, 60) {
				cout << d[i][j];
			}
			cout << endl;
		}
		*/
		
	}

	vector<ll> sum(60, 0);

	repn(i, N) {
		rep(j, 60) {
			sum[j]+=d[i][j];
		}
	}

	//rep(j, 60) { cout << count1[j] << endl; }

	ll ans=0;

	rep(j, 60) {
		ans += (count1[j]%2+2*(sum[j]%2)) * p(59-j);
	}

	cout << ans;

	

	system("PAUSE");

}
