#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define F first
#define S second
#define PB push_back
#define PF push front
#define MP make_pair
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define FORD(x, b, e) for(int x=b; x>=(e); --x)
#define VAR(v,n) __typeof(n) v=(n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
#define SORT(v) sort((v).begin(),(v).end())
#define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; }

typedef vector<int>    VI;
typedef vector<VI>     VVI;
typedef vector<LL>     VLL;
typedef vector<bool>   VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII>    VPII;
typedef pair<LL, LL>   PLL;
typedef vector<PLL>    VPLL;

const double EPS = 10e-9;
const double INF = (1LL << 30);

using namespace std;

class node {
public:
    int num;
    node *one;
    node *zero;
    node(int n) : one(0), zero(0), num(n) {;}
};

void partition(int bit, VLL &nums, VLL &left, VLL &right) {
    REP(i, nums.size()) {
        if(nums[i] & (1LL << bit))
            left.push_back(nums[i]);
        else
            right.push_back(nums[i]);
    }
}

node* build(int bit, VLL &nums) {
    VLL left, right;
    node *nd = new node(nums.size());
    partition(bit, nums, left, right);
    if(bit == 0) {
        if(left.size() != 0)
            nd->one = new node(left.size());
        if(right.size() != 0)
            nd->zero = new node(right.size());
        return nd;
    }

    if(left.size() != 0) {
        nd->one = build(bit-1, left);
    }
    if(right.size() != 0) {
        nd->zero = build(bit-1, right);
    }
    return nd;
}

LL find(LL num, int bit, node *nd) {
    // already number is > 0
    if(bit == -1)
        return 0;

    LL found;
    if(num & (1LL << bit)) {
        if(nd->zero && nd->zero->num > 0) {
            found = find(num, bit-1, nd->zero);
        } else {
            found = (1LL << bit) | find(num, bit-1, nd->one);
        }
    }
    else {
        if(nd->one && nd->one->num > 0) {
            found = (1LL << bit) | find(num, bit-1, nd->one);
        } else {
            found = find(num, bit-1, nd->zero);
        }
    }
    return found;
}

void remove(LL num, int bit, node *nd) {
    if(bit == -1)
        return;
    if(num & (1LL << bit)) {
        remove(num, bit-1, nd->one);
        nd->one->num--;
    }
    else {
        remove(num, bit-1, nd->zero);
        nd->zero->num--;
    }
}

bool isin(LL num, int bit, node *nd) {
    if(bit == -1) return true;
    if(num & (1LL << bit)) {
        if(nd->one && nd->one->num > 0)
            return isin(num, bit-1, nd->one);
    } else {
        if(nd->zero && nd->zero->num > 0)
            return isin(num, bit-1, nd->zero);
    }
    return false;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    int N;
    cin >> N;
    VLL nums(N, 0);

    LL toDeleteXor = 0;
    REP(i, N) {
        cin >> nums[i];
        toDeleteXor ^= nums[i];
    }

    VLL xors(N+1, 0);
    FORD(i, nums.size()-1, 0) {
        xors[i] = xors[i+1] ^ nums[i];
    }

    int hibit = 0;
    REP(i, xors.size()) {
        REP(j, 60) {
            if(xors[i] & (1LL << j))
                hibit = max(hibit, j);
        }
    }

    node *nd = build(hibit, xors);

    LL maxMatch = 0, currXor = 0;
    REP(i, N+1) {
        LL match = find(currXor, hibit, nd);
        maxMatch = max(maxMatch, currXor ^ match);

        if(i != N) {
            toDeleteXor ^= nums[i];
            if(toDeleteXor != 0) {
                //assert(isin(toDeleteXor, hibit, nd));
                remove(toDeleteXor, hibit, nd);
            }
            currXor ^= nums[i];
        }
    }

    cout << maxMatch << endl;

    return 0;
}


#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define F first
#define S second
#define PB push_back
#define PF push front
#define MP make_pair
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define FORD(x, b, e) for(int x=b; x>=(e); --x)
#define VAR(v,n) __typeof(n) v=(n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
#define SORT(v) sort((v).begin(),(v).end())
#define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; }

typedef vector<int>    VI;
typedef vector<VI>     VVI;
typedef vector<LL>     VLL;
typedef vector<bool>   VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII>    VPII;
typedef pair<LL, LL>   PLL;
typedef vector<PLL>    VPLL;

const double EPS = 10e-9;
const double INF = (1LL << 30);

using namespace std;

class node {
public:
    int num;
    node *one;
    node *zero;
    node(int n) : one(0), zero(0), num(n) {;}
};

void partition(int bit, VLL &nums, VLL &left, VLL &right) {
    REP(i, nums.size()) {
        if(nums[i] & (1LL << bit))
            left.push_back(nums[i]);
        else
            right.push_back(nums[i]);
    }
}

node* build(int bit, VLL &nums) {
    VLL left, right;
    node *nd = new node(nums.size());
    partition(bit, nums, left, right);
    if(bit == 0) {
        if(left.size() != 0)
            nd->one = new node(left.size());
        if(right.size() != 0)
            nd->zero = new node(right.size());
        return nd;
    }

    if(left.size() != 0) {
        nd->one = build(bit-1, left);
    }
    if(right.size() != 0) {
        nd->zero = build(bit-1, right);
    }
    return nd;
}

LL find(LL num, int bit, node *nd) {
    // already number is > 0
    if(bit == -1)
        return 0;

    LL found;
    if(num & (1LL << bit)) {
        if(nd->zero && nd->zero->num > 0) {
            found = (1LL << bit) | find(num, bit-1, nd->zero);
        } else {
            found = find(num, bit-1, nd->one);
        }
    }
    else {
        if(nd->one && nd->one->num > 0) {
            found = (1LL << bit) | find(num, bit-1, nd->one);
        } else {
            found = find(num, bit-1, nd->zero);
        }
    }
    return found;
}

void remove(LL num, int bit, node *nd) {
    if(bit == -1)
        return;
    if(num & (1LL << bit)) {
        remove(num, bit-1, nd->one);
        nd->one->num--;
    }
    else {
        remove(num, bit-1, nd->zero);
        nd->zero->num--;
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    int N;
    cin >> N;
    VLL nums(N, 0);

    LL toDeleteXor = 0;
    REP(i, N) {
        cin >> nums[i];
        toDeleteXor ^= nums[i];
    }

    VLL xors(N+1, 0);
    FORD(i, nums.size()-1, 0) {
        xors[i] = xors[i+1] ^ nums[i];
    }

    int hibit = 0;
    REP(i, xors.size()) {
        REP(j, 60) {
            if(xors[i] & (1LL << j))
                hibit = max(hibit, j);
        }
    }

    node *nd = build(hibit, xors);

    LL maxMatch = 0, currXor = 0;
    REP(i, N) {
        LL match = find(currXor, hibit, nd);
        maxMatch = max(maxMatch, currXor ^ match);

        toDeleteXor ^= nums[i];
        if(toDeleteXor != 0) {
            remove(toDeleteXor, hibit, nd);
        }
        currXor ^= nums[i];
    }

    cout << maxMatch << endl;

    return 0;
}


#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <fstream>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define F first
#define S second
#define PB push_back
#define PF push front
#define MP make_pair
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=b; x<=(e); ++x)
#define FORD(x, b, e) for(int x=b; x>=(e); --x)
#define VAR(v,n) __typeof(n) v=(n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define MOD(x, n) ((x)%(n)+(n))%(n)
#define SZ(x) (int((x).size()))
#define ALL(x) ((x).begin()),((x).end())
#define SORT(v) sort((v).begin(),(v).end())
#define UNIQUE(v) SORT(v),(v).erase(unique((v).begin(),(v).end()),(v).end())
LL GCD( LL a , LL b ) { while( b ) b ^= a ^= b ^= a %= b ; return a ; }
LL LCM( LL a , LL b ) { return a * ( b / GCD( a , b ) ) ; }

typedef vector<int>    VI;
typedef vector<VI>     VVI;
typedef vector<LL>     VLL;
typedef vector<bool>   VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII>    VPII;
typedef pair<LL, LL>   PLL;
typedef vector<PLL>    VPLL;

const double EPS = 10e-9;
const double INF = (1LL << 30);

using namespace std;

class node {
public:
    int num;
    node *one;
    node *zero;
    node(int n) : one(0), zero(0), num(n) {;}
};

void partition(int bit, VLL &nums, VLL &left, VLL &right) {
    REP(i, nums.size()) {
        if(nums[i] & (1LL << bit))
            left.push_back(nums[i]);
        else
            right.push_back(nums[i]);
    }
}

node* build(int bit, VLL &nums) {
    VLL left, right;
    node *nd = new node(nums.size());
    partition(bit, nums, left, right);
    if(bit == 0) {
        if(left.size() != 0)
            nd->one = new node(left.size());
        if(right.size() != 0)
            nd->zero = new node(right.size());
        return nd;
    }

    if(left.size() != 0) {
        nd->one = build(bit-1, left);
    }
    if(right.size() != 0) {
        nd->zero = build(bit-1, right);
    }
    return nd;
}

LL find(LL num, int bit, node *nd) {
    // already number is > 0
    if(bit == -1)
        return 0;

    LL found;
    if(num & (1LL << bit)) {
        if(nd->zero && nd->zero->num > 0) {
            found = (1LL << bit) | find(num, bit-1, nd->zero);
        } else {
            found = find(num, bit-1, nd->one);
        }
    }
    else {
        if(nd->one && nd->one->num > 0) {
            found = (1LL << bit) | find(num, bit-1, nd->one);
        } else {
            found = find(num, bit-1, nd->zero);
        }
    }
    return found;
}

void remove(LL num, int bit, node *nd) {
    if(bit == -1)
        return;
    if(num & (1LL << bit)) {
        remove(num, bit-1, nd->one);
        nd->one->num--;
    }
    else {
        remove(num, bit-1, nd->zero);
        nd->zero->num--;
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif

    int N;
    cin >> N;
    VLL nums(N, 0);

    LL toDeleteXor = 0;
    REP(i, N) {
        cin >> nums[i];
        toDeleteXor ^= nums[i];
    }

    VLL xors(N+1, 0);
    FORD(i, nums.size()-1, 0) {
        xors[i] = xors[i+1] ^ nums[i];
    }

    int hibit = 0;
    REP(i, xors.size()) {
        REP(j, 60) {
            if(xors[i] & (1LL << j))
                hibit = max(hibit, j);
        }
    }

    node *nd = build(hibit, xors);

    LL maxMatch = 0, currXor = 0;
    REP(i, N) {
        LL match = find(currXor, hibit, nd);
        maxMatch = max(maxMatch, currXor ^ match);
        if(toDeleteXor != 0) {
            remove(toDeleteXor, hibit, nd);
        }
        currXor ^= nums[i];
        toDeleteXor ^= nums[i];
    }

    cout << maxMatch << endl;

    return 0;
}


#include <vector>
#include <map>
//#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>

using namespace std;

#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define pb push_back
#define mp make_pair
#define fi first
#define se second

struct trie
{
	int cnt;
	trie* child[2];

	trie()
	{
		cnt=0;
		for(int i=0;i<2;++i)
			child[i]=NULL;
	}

	void insert(long long x,int pos)
	{
		++cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			if(child[1]==NULL) child[1]=new trie();
			child[1]->insert(x,pos-1);
		}
		else
		{
			if(child[0]==NULL) child[0]=new trie();
			child[0]->insert(x,pos-1);
		}
	}

	void Delete(long long x,int pos)
	{
		--cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			child[1]->Delete(x,pos-1);
			if(child[1]->cnt==0) child[1]=NULL;
		}
		else
		{
			child[0]->Delete(x,pos-1);
			if(child[0]->cnt==0) child[0]=NULL;
		}
	}

	long long qmax(long long x,int pos)
	{
		if(pos==-1) return 0;
		if(x&(1LL<<pos))
		{
			//assert(child[0]!=NULL || child[1]!=NULL);
			if(child[0]!=NULL) return (1LL<<pos)+child[0]->qmax(x,pos-1);
			return child[1]->qmax(x,pos-1);
		}
		else
		{
			//assert(child[0]!=NULL || child[1]!=NULL);
			if(child[1]!=NULL) return (1LL<<pos)+child[1]->qmax(x,pos-1);
			return child[0]->qmax(x,pos-1);
		}
	}
};

int main()
{
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;++i)
		cin>>a[i];
	vector<long long> xx(n);
	xx[n-1]=a[n-1];
	for(int i=n-2;i>=0;--i)
		xx[i]=(a[i]^xx[i+1]);
	long long answer=0;
	for(int i=0;i<n;++i) answer=max(answer,xx[i]);
	trie my;
	for(int i=0;i<n;++i) my.insert(xx[i],41);
	long long v=0;
	for(int i=0;i<n-1;++i)
	{
		my.Delete(xx[i],41);
		v^=a[i];
		answer=max(answer,my.qmax(v,41));
		answer=max(answer,v);
	}
	cout<<answer;
	return 0;
}


#include <vector>
#include <map>
//#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>

using namespace std;

#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define pb push_back
#define mp make_pair
#define fi first
#define se second

struct trie
{
	int cnt;
	trie* child[2];

	trie()
	{
		cnt=0;
		for(int i=0;i<2;++i)
			child[i]=NULL;
	}

	void insert(long long x,int pos)
	{
		++cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			if(child[1]==NULL) child[1]=new trie();
			child[1]->insert(x,pos-1);
		}
		else
		{
			if(child[0]==NULL) child[0]=new trie();
			child[0]->insert(x,pos-1);
		}
	}

	void Delete(long long x,int pos)
	{
		--cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			child[1]->Delete(x,pos-1);
			if(child[1]->cnt==0) child[1]=NULL;
		}
		else
		{
			child[0]->Delete(x,pos-1);
			if(child[0]->cnt==0) child[0]=NULL;
		}
	}

	long long qmax(long long x,int pos)
	{
		if(pos==-1) return 0;
		if(x&(1LL<<pos))
		{
			assert(child[0]!=NULL || child[1]!=NULL);
			if(child[0]!=NULL) return (1LL<<pos)+child[0]->qmax(x,pos-1);
			return child[1]->qmax(x,pos-1);
		}
		else
		{
			assert(child[0]!=NULL || child[1]!=NULL);
			if(child[1]!=NULL) return (1LL<<pos)+child[1]->qmax(x,pos-1);
			return child[0]->qmax(x,pos-1);
		}
	}
};

int main()
{
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;++i)
		cin>>a[i];
	vector<long long> xx(n);
	xx[n-1]=a[n-1];
	for(int i=n-2;i>=0;--i)
		xx[i]=(a[i]^xx[i+1]);
	long long answer=0;
	for(int i=0;i<n;++i) answer=max(answer,xx[i]);
	trie my;
	for(int i=0;i<n;++i) my.insert(xx[i],41);
	long long v=0;
	for(int i=0;i<n-1;++i)
	{
		my.Delete(xx[i],41);
		v^=a[i];
		answer=max(answer,my.qmax(v,41));
		answer=max(answer,v);
	}
	cout<<answer;
	return 0;
}


#include <vector>
#include <map>
//#include <unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>

using namespace std;

#define sz(a) (int)(a.size())
#define len(a) (int)(a.length())
#define pb push_back
#define mp make_pair
#define fi first
#define se second

struct trie
{
	int cnt;
	trie* child[2];

	trie()
	{
		cnt=0;
		for(int i=0;i<2;++i)
			child[i]=NULL;
	}

	void insert(int x,int pos)
	{
		++cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			if(child[1]==NULL) child[1]=new trie();
			child[1]->insert(x,pos-1);
		}
		else
		{
			if(child[0]==NULL) child[0]=new trie();
			child[0]->insert(x,pos-1);
		}
	}

	void Delete(int x,int pos)
	{
		--cnt;
		if(pos==-1) return;
		if(x&(1LL<<pos))
		{
			child[1]->Delete(x,pos-1);
			if(child[1]->cnt==0) child[1]=NULL;
		}
		else
		{
			child[0]->Delete(x,pos-1);
			if(child[0]->cnt==0) child[0]=NULL;
		}
	}

	long long qmax(int x,int pos)
	{
		if(pos==-1) return 0;
		if(x&(1LL<<pos))
		{
			assert(child[0]!=NULL || child[1]!=NULL);
			if(child[0]!=NULL) return (1LL<<pos)+child[0]->qmax(x,pos-1);
			return child[1]->qmax(x,pos-1);
		}
		else
		{
			assert(child[0]!=NULL || child[1]!=NULL);
			if(child[1]!=NULL) return (1LL<<pos)+child[1]->qmax(x,pos-1);
			return child[0]->qmax(x,pos-1);
		}
	}
};

int main()
{
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;++i)
		cin>>a[i];
	vector<long long> xx(n);
	xx[n-1]=a[n-1];
	for(int i=n-2;i>=0;--i)
		xx[i]=(a[i]^xx[i+1]);
	long long answer=0;
	for(int i=0;i<n;++i) answer=max(answer,xx[i]);
	trie my;
	for(int i=0;i<n;++i) my.insert(xx[i],41);
	long long v=0;
	for(int i=0;i<n-1;++i)
	{
		my.Delete(xx[i],41);
		v^=a[i];
		answer=max(answer,my.qmax(v,41));
		answer=max(answer,v);
	}
	cout<<answer;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#define REP(i,n) for(int i=0;i<(int)n;++i)
#ifdef __GNUC__
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T val){
  val = val - ((val >> 1) & 0x55555555);
  val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
  val = (val + (val >> 4)) & 0x0f0f0f0f;
  val += val >> 8;
  val += val >> 16;
  return (int)(val & 0x0000003f);
}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

ll as[100001];
int N;
ll nowLeft=0;
ll nowRight=0;
ll res=0;

struct Node{
  int num;
  Node *zero,*one;
};

Node *root;

void add(Node *now,int pos,ll num){
  if(pos==60)return;
  int a=num%2;
  if(a==0){
    if(now->zero==NULL){
      now->zero=new Node();
      now->zero->num=a;
    }
    add(now->zero,pos+1,num/2);
  }
  else{
    if(now->one==NULL){
      now->one=new Node();
      now->one->num=a;
    }
    add(now->one,pos+1,num/2);
  }
}

void search(Node *now,int pos,ll num,ll &res){
  if(pos==60)return;
  ll a=num%2;
  if(a){
    if(now->zero!=NULL){
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
    else{
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
  }
  else{
    if(now->one!=NULL){
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
    else{
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
  }
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>as[i];
    nowLeft^=as[i];
  }
  root=new Node();
  for(int i=N-1;i>=0;i--){
    //cout<<nowLeft<<" "<<nowRight<<endl;
    if(i==N-1){
      res=max(res,nowLeft);
    }
    else{
      ll tmp=0;
      add(root,0,nowRight);
      //cout<<i<<endl;
      search(root,0,nowLeft,tmp);
      res=max(res,nowLeft^tmp);
    }
    nowRight^=as[i];
    nowLeft^=as[i];
    res=max(res,nowRight);
    res=max(res,nowLeft);
  }

  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      ll left=0;
      ll right=0;
      for(int k=0;k<=i;k++){
        left^=as[k];
      }
      for(int k=j;k<N;k++){
        right^=as[k];
      }
      res=max(res,left^right);
    }
  }

  cout<<res<<endl;

  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#define REP(i,n) for(int i=0;i<(int)n;++i)
#ifdef __GNUC__
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T val){
  val = val - ((val >> 1) & 0x55555555);
  val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
  val = (val + (val >> 4)) & 0x0f0f0f0f;
  val += val >> 8;
  val += val >> 16;
  return (int)(val & 0x0000003f);
}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

ll as[100001];
int N;
ll nowLeft=0;
ll nowRight=0;
ll res=0;

struct Node{
  int num;
  Node *zero,*one;
};

Node *root;

void add(Node *now,int pos,ll num){
  if(pos==60)return;
  int a=num%2;
  if(a==0){
    if(now->zero==NULL){
      now->zero=new Node();
      now->zero->num=a;
    }
    add(now->zero,pos+1,num/2);
  }
  else{
    if(now->one==NULL){
      now->one=new Node();
      now->one->num=a;
    }
    add(now->one,pos+1,num/2);
  }
}

void search(Node *now,int pos,ll num,ll &res){
  if(pos==60)return;
  ll a=num%2;
  if(a){
    if(now->zero!=NULL){
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
    else{
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
  }
  else{
    if(now->one!=NULL){
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
    else{
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
  }
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>as[i];
    nowLeft^=as[i];
  }
  root=new Node();
  for(int i=N-1;i>=0;i--){
    //cout<<nowLeft<<" "<<nowRight<<endl;
    if(i==N-1){
      res=max(res,nowLeft);
    }
    else{
      ll tmp=0;
      add(root,0,nowRight);
      //cout<<i<<endl;
      search(root,0,nowLeft,tmp);
      res=max(res,nowLeft^tmp);
    }
    nowRight^=as[i];
    nowLeft^=as[i];
    res=max(res,nowRight);
    res=max(res,nowLeft);
  }
  cout<<res<<endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#define REP(i,n) for(int i=0;i<(int)n;++i)
#ifdef __GNUC__
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T val){
  val = val - ((val >> 1) & 0x55555555);
  val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
  val = (val + (val >> 4)) & 0x0f0f0f0f;
  val += val >> 8;
  val += val >> 16;
  return (int)(val & 0x0000003f);
}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

ll as[100001];
int N;
ll nowLeft=0;
ll nowRight=0;
ll res=0;

struct Node{
  int num;
  Node *zero,*one;
};

Node *root;

void add(Node *now,int pos,ll num){
  if(pos==-1)return;
  //int a=num%2;
  ll a=(num>>pos)&1;
  if(a==0){
    if(now->zero==NULL){
      now->zero=new Node();
      now->zero->num=a;
    }
    add(now->zero,pos-1,num);
  }
  else{
    if(now->one==NULL){
      now->one=new Node();
      now->one->num=a;
    }
    add(now->one,pos-1,num);
  }
}

void search(Node *now,int pos,ll num,ll &res){
  if(pos==-1)return;
  ll a=(num>>pos)&1;
  if(a){
    if(now->zero!=NULL){
      res|=(0LL<<pos);
      search(now->zero,pos-1,num,res);
    }
    else{
      res|=(1LL<<pos);
      search(now->one,pos-1,num,res);
    }
  }
  else{
    if(now->one!=NULL){
      res|=(1LL<<pos);
      search(now->one,pos-1,num,res);
    }
    else{
      res|=(0LL<<pos);
      search(now->zero,pos-1,num,res);
    }
  }
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>as[i];
    nowLeft^=as[i];
  }
  root=new Node();
  for(int i=N-1;i>=0;i--){
    if(i==N-1){
      res=max(res,nowLeft);
    }
    else{
      ll tmp=0;
      add(root,60,nowRight);
      search(root,60,nowLeft,tmp);
      res=max(res,nowLeft^tmp);
    }
    nowRight^=as[i];
    nowLeft^=as[i];
    res=max(res,nowRight);
    res=max(res,nowLeft);
  }
  cout<<res<<endl;
  return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#define REP(i,n) for(int i=0;i<(int)n;++i)
#ifdef __GNUC__
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T val){
  val = val - ((val >> 1) & 0x55555555);
  val = (val & 0x33333333) + ((val >> 2) & 0x33333333);
  val = (val + (val >> 4)) & 0x0f0f0f0f;
  val += val >> 8;
  val += val >> 16;
  return (int)(val & 0x0000003f);
}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

ll as[100001];
int N;
ll nowLeft=0;
ll nowRight=0;
ll res=0;

struct Node{
  int num;
  Node *zero,*one;
};

Node *root;

void add(Node *now,int pos,ll num){
  if(pos==60)return;
  int a=num%2;
  if(a==0){
    if(now->zero==NULL){
      now->zero=new Node();
      now->zero->num=a;
    }
    add(now->zero,pos+1,num/2);
  }
  else{
    if(now->one==NULL){
      now->one=new Node();
      now->one->num=a;
    }
    add(now->one,pos+1,num/2);
  }
}

void search(Node *now,int pos,ll num,ll &res){
  if(pos==60)return;
  ll a=num%2;
  if(a){
    if(now->zero!=NULL){
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
    else{
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
  }
  else{
    if(now->one!=NULL){
      res|=(1LL<<pos);
      search(now->one,pos+1,num/2,res);
    }
    else{
      res|=(0LL<<pos);
      search(now->zero,pos+1,num/2,res);
    }
  }
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>as[i];
    nowLeft^=as[i];
  }
  root=new Node();
  for(int i=N-1;i>=0;i--){
    //cout<<nowLeft<<" "<<nowRight<<endl;
    if(i==N-1){
      res=max(res,nowLeft);
    }
    else{
      ll tmp=0;
      add(root,0,nowRight);
      //cout<<i<<endl;
      search(root,0,nowLeft,tmp);
      res=max(res,nowLeft^tmp);
    }
    nowRight^=as[i];
    nowLeft^=as[i];
    res=max(res,nowRight);
  }
  cout<<res<<endl;
  return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;

#define SIZE 100005
typedef unsigned long long int ulli;
typedef long long int slli;
typedef pair<int,int> pr;
slli num[SIZE];
slli f[SIZE];
slli b[SIZE];
slli node_id;
unordered_map< int, pr > trie;
//pr trie[10000000]; //TODO try figure out how to esimate

slli find_max(slli n)
{
  slli now = 0;
  slli M = 0;
  for(int i=40; i>=0; --i)
  {
    int bit = (n>>i)&1;
    if(!bit)
    {
      if(trie[now].second != 0)
      {
        M |= (1ll)<<i;
        now = trie[now].second;
      }
      else
        now = trie[now].first;
    }
    else
    {
      if(trie[now].first != 0)
      {
        M |= (1ll)<<i;
        now = trie[now].first;
      }
      else
        now = trie[now].second;
    }
  }
  return M;
}

void insert(slli n)
{
  slli now = 0;
  for(int i=40; i>=0; --i)
  {
    int bit = (n>>i)&1;
    if(!bit)
    {
      if(trie[now].first == 0)
      {
        trie[now].first = ++node_id;
        trie[node_id] = make_pair(0,0);
      }
      now = trie[now].first;
    }
    else
    {
      if(trie[now].second == 0)
      {
        trie[now].second = ++node_id;
        trie[node_id] = make_pair(0,0);
      }
      now = trie[now].second;
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for(int i=0; i<n; ++i)
    cin >> num[i];

  f[0] = num[0];
  for(int i=1; i<n; ++i)
    f[i] = (num[i]^f[i-1]);

  b[n-1] = num[n-1];
  for(int i=n-2; i>=0; --i)
    b[i] = (num[i]^b[i+1]);

  trie[0] = make_pair(0,0);
  insert(0);
  slli M = 0;

  if(b[0] > M)
    M = b[0];
  if(f[0] > M)
    M = f[0];

  for(int i=1; i<n; ++i)
  {
    M = max(M, b[i]);
    M = max(M, f[i]);
    M = max(M, find_max(b[i]));
    insert(f[i-1]);
  }
  /*trie.clear();
  trie[0] = make_pair(0,0);
  insert(0);

  for(int i=n-2; i>=0; --i)
  {
    M = max(M, find_max(f[i]));
    insert(f[i+1]);
  }*/

  cout << M << endl;
}


// HadronWave (c)
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979;

struct ver{
    int next[2];
    ll leaf;
};

int Size = 2;

ver mas[64*100001];

void add(ll toadd){
    int cur = 1;
    for(ll i=40;i>=0;--i){
        int next = (toadd>>i)&1;
        if(!mas[cur].next[next]){
            mas[cur].next[next] = Size;
            ++Size;
        }
        cur = mas[cur].next[next];
    }
    mas[cur].leaf = toadd;
}

ll find(ll first){
    int cur = 1;
    for(ll i=40;i>=0;--i){
        int next = 1-((first>>i)&1);
        if(!mas[cur].next[next]) next = 1-next;
        cur = mas[cur].next[next];
    }

    //cout << first << ' ' << mas[cur].leaf << endl;
    return first ^ mas[cur].leaf;
}

ll a[100001];

int main()
{
    //freopen("tables.in","r",stdin);
    //freopen("tables.out","w",stdout);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    ll ans = 0;
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%I64d",&a[i]);
        a[i] ^= a[i-1];
        //printf("%I64d ",a[i]);
    }
    for(int i=0;i<=n;++i){
        add(a[i]);
    }
    for(int i=0;i<=n;++i){
        ans = max(ans,find(a[i]^a[n]));
    }
    printf("%I64d",ans);
    return 0;
}


#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979;

int main()
{
    //freopen("tables.in","r",stdin);
    //freopen("tables.out","w",stdout);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    //int n, t, s = 0, s2 = 0;
    int n,a;
    cin >> n;
    // nothing to try
    vector< ll > A(n);
    ll total = 0;
    for (int i=0; i<n; ++i) {
        cin >> A[i];
        total ^= A[i];
    }
    ll ans = max(A[0],total), xs = 0, xms = 0;
    for (int r=0; r<n; ++r) {
        xs ^= A[r];
        ans = max (ans, xs ^ xms);
        xms = min (xms, xs);
    }

    cout << ans;

    return 0;
}


#include <stdio.h>
int n;
long long num[100010],suma[100010],sumb[100010],ans;
int l[4000010],r[4000010],tot;
long long max(long long a,long long b)
{
	return a>b?a:b;
}
void add(long long x)
{
	int i,now = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(!r[now]) r[now] = ++tot;
			now = r[now];
		}
		else
		{
			if(!l[now]) l[now] = ++tot;
			now = l[now];
		}
	}
}
int query(long long x)
{
	int i,now = 0;
	long long ret = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(l[now]) { now = l[now]; ret |= 1LL<<i;}
			else now = r[now];
		}
		else
		{
			if(r[now]) { now = r[now]; ret |= 1LL<<i;}
			else now = l[now];
		}
	}
	return ret;
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++) { scanf("%I64d",&num[i]); suma[i] = suma[i-1]^num[i];}
	for(i=n;i;i--) sumb[i] = sumb[i+1]^num[i];
	add(0);
	for(i=1;i<=n+1;i++)
	{
		ans = max(ans,query(sumb[i]));
		add(suma[i]);
	}
	printf("%I64d",ans);
	return 0;
}


#include <stdio.h>
int n;
long long num[100010],suma[100010],sumb[100010],ans;
int l[4000010],r[4000010],tot;
long long max(long long a,long long b)
{
	return a>b?a:b;
}
void add(long long x)
{
	int i,now = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(!r[now]) r[now] = ++tot;
			now = r[now];
		}
		else
		{
			if(!l[now]) l[now] = ++tot;
			now = l[now];
		}
	}
}
long long query(long long x)
{
	int i,now = 0;
	long long ret = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(l[now]) { now = l[now]; ret |= 1LL<<i;}
			else now = r[now];
		}
		else
		{
			if(r[now]) { now = r[now]; ret |= 1LL<<i;}
			else now = l[now];
		}
	}
	return ret;
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++) { scanf("%I64d",&num[i]); suma[i] = suma[i-1]^num[i];}
	for(i=n;i;i--) sumb[i] = sumb[i+1]^num[i];
	add(0);
	for(i=1;i<=n+1;i++)
	{
		ans = max(ans,query(sumb[i]));
		add(suma[i]);
	}
	printf("%I64d",ans);
	return 0;
}


#include <stdio.h>
int n;
long long num[100010],suma[100010],sumb[100010],ans;
int l[4000010],r[4000010],tot;
long long max(long long a,long long b)
{
	return a>b?a:b;
}
void add(long long x)
{
	int i,now = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(!r[now]) r[now] = ++tot;
			now = r[now];
		}
		else
		{
			if(!l[now]) l[now] = ++tot;
			now = l[now];
		}
	}
}
int query(long long x)
{
	int i,now = 0;
	long long ret = 0;
	for(i=39;i>=0;i--)
	{
		if(x>>i&1)
		{
			if(l[now]) { now = l[now]; ret |= 1<<i;}
			else now = r[now];
		}
		else
		{
			if(r[now]) { now = r[now]; ret |= 1<<i;}
			else now = l[now];
		}
	}
	return ret;
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++) { scanf("%I64d",&num[i]); suma[i] = suma[i-1]^num[i];}
	for(i=n;i;i--) sumb[i] = sumb[i+1]^num[i];
	add(0);
	for(i=1;i<=n+1;i++)
	{
		ans = max(ans,query(sumb[i]));
		add(suma[i]);
	}
	printf("%I64d",ans);
	return 0;
}


#include <stdio.h>
#include <string.h>

#define max(a,b) ((a)>=(b)?(a):(b))
#define MaxN 100001
#define DEPTH 41

// TRIE tree Node structure
typedef struct strucTreeNode{
	int nCount;
	int next[2];
}treeNode;

treeNode tree[DEPTH*MaxN];
int alloc = 0;

int createNode(){
	alloc++;
	tree[alloc].next[0] = 0;
	tree[alloc].next[1] = 0;
	return alloc;
}

void inittree(){
	alloc = 0;
	createNode();
}
int entree(long long val){
	int pos=1;
	long long move = 1;
	for (int i = DEPTH-1; i >= 0; i--){
		long long moved = val&(move << i);
		int d = (moved != 0);
		if (0==tree[pos].next[d]){
			tree[pos].next[d] = createNode();
		}
		pos = tree[pos].next[d];
	}
	tree[pos].nCount++;
	return 0;
}

long long find(long long val){

	int pos = 1;
	long long move = 1LL;

	long long reval = 0LL;
	for (int shift = DEPTH - 1; shift >= 0;shift--){
		int d = 1;
		if ((val&(move << shift)) > 0){
			d = 0;
		}
		int k = d;
		if (tree[pos].next[d] == 0){
			k = 1 - k;
		}

		reval = reval | ((move&(long long)k) << shift);
		//next loop
		pos = tree[pos].next[k];
	}
	return reval;
}

int main(){
	inittree();

	int n=-1;
	long long a[MaxN];
	while (scanf("%d", &n)!=EOF){
		inittree();
		long long maxval = 0;
		long long postfix = 0;
		long long prefix = 0;
		for (int i = 0; i < n; i++){
			scanf("%I64d", &a[i]);
			postfix ^= a[i];
		}
		maxval = postfix;
		entree(prefix);
		for (int i = 0; i < n; i++){
			prefix = prefix^a[i];
			postfix = postfix^a[i];
			entree(prefix);
			long long findval = postfix^find(postfix);
			maxval = max(maxval, findval);
		}
		printf("%I64d\n", maxval);
	}

}


#include<stdio.h>
#define max(a,b) a>b?a:b
struct TreeNode
{
    struct TreeNode *left;
    struct TreeNode *right;
};
typedef struct TreeNode TreeNode;
long long n,a[100007];
int bin[40];
TreeNode *root;
TreeNode* createNode()
{
    TreeNode *t=(TreeNode*)malloc(sizeof(TreeNode));
    t->left=NULL;
    t->right=NULL;
    return t;
}
void binary(long long n)
{
    int i;
    for(i=0;i<40;i++)
    {
        bin[i]=n%2;
        n=n/2;
    }
}
void Insert(TreeNode *node,int bit)
{
    if(bin[bit]==0)
    {
        if(node->left==NULL)
        {
            node->left=createNode();
        }
        if(bit)
            Insert(node->left,bit-1);
    }
    else
    {
        if(node->right==NULL)
        {
            node->right=createNode();
        }
        if(bit)
            Insert(node->right,bit-1);
    }
}
long long Query(TreeNode *node,int bit)
{
    if(bit==-1)
        return 0;
    long long ans=0;
    if(!bin[bit])
    {
        if(node->right!=NULL)
        {
            ans=Query(node->right,bit-1);
            ans+=(long long)((long long)1<<(long long)bit);
        }
        else
        {
            ans=Query(node->left,bit-1);
        }

    }
    else
    {
        if(node->left!=NULL)
        {
            ans=Query(node->left,bit-1);
            ans+=(long long)((long long)1<<(long long)bit);
        }
        else
        {
            ans=Query(node->right,bit-1);
        }
    }
    return ans;
}
int main()
{
    long long i,ans,x,m=0;
    root=createNode();
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    x=0;
    Insert(root,39);
    for(i=0;i<=n;i++)
    {
        x=x^a[i];
        binary(x);
        Insert(root,39);
        ans=Query(root,39);
        m=max(m,ans);
    }
    printf("%lld\n",m);
    return 0;
}


#include<stdio.h>
#define max(a,b) a>b?a:b
struct TreeNode
{
    struct TreeNode *left;
    struct TreeNode *right;
};
typedef struct TreeNode TreeNode;
long long n,a[100007];
int bin[40];
TreeNode *root;
TreeNode* createNode()
{
    TreeNode *t=(TreeNode*)malloc(sizeof(TreeNode));
    t->left=NULL;
    t->right=NULL;
    return t;
}
void binary(long long n)
{
    int i;
    for(i=0;i<40;i++)
    {
        bin[i]=n%2;
        n=n/2;
    }
}
void Insert(TreeNode *node,int bit)
{
    if(bin[bit]==0)
    {
        if(node->left==NULL)
        {
            node->left=createNode();
        }
        if(bit)
            Insert(node->left,bit-1);
    }
    else
    {
        if(node->right==NULL)
        {
            node->right=createNode();
        }
        if(bit)
            Insert(node->right,bit-1);
    }
}
long long Query(TreeNode *node,int bit)
{
    if(bit==-1)
        return 0;
    long long ans=0;
    if(!bin[bit])
    {
        if(node->right!=NULL)
        {
            ans=Query(node->right,bit-1);
            ans+=(long long)((long long)1<<(long long)bit);
        }
        else
        {
            ans=Query(node->left,bit-1);
        }

    }
    else
    {
        if(node->left!=NULL)
        {
            ans=Query(node->left,bit-1);
            ans+=(long long)((long long)1<<(long long)bit);
        }
        else
        {
            ans=Query(node->right,bit-1);
        }
    }
    return ans;
}
int main()
{
    long long i,ans,x,m=0;
    root=createNode();
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    x=0;
    Insert(root,39);
    for(i=0;i<n;i++)
    {
        x=x^a[i];
        binary(x);
        Insert(root,39);
    }
    x=0;
    for(i=n-1;i>=0;i--)
    {
        x=x^a[i];
        binary(x);
        ans=Query(root,39);
        m=max(m,ans);
    }
    printf("%lld\n",m);
    return 0;
}


#include<stdio.h>
#define max(a,b) a>b?a:b
struct TreeNode
{
    struct TreeNode *left;
    struct TreeNode *right;
    long long value;

};
typedef struct TreeNode TreeNode;
long long n,a[100007],left[100007]={0},right[100007]={0};
TreeNode *root;
TreeNode* createNode()
{
    TreeNode *t=(TreeNode*)malloc(sizeof(TreeNode));
    t->left=NULL;
    t->right=NULL;
    t->value=-1;
    return t;
}
void Insert(TreeNode *node,long long x,int bit)
{
    if(bit==-1)
    {
        node->value=x;
        return;
    }
    if(x&(1<<bit))
    {
        if(node->right==NULL)
        {
            node->right=createNode();
        }
        Insert(node->right,x,bit-1);
    }
    else
    {
        if(node->left==NULL)
        {
            node->left=createNode();
        }
        Insert(node->left,x,bit-1);
    }
}
long long Query(TreeNode *node,long long x,int bit)
{
    if(bit==-1)
    {
        return node->value;
    }
    long ans=0;
    if(x&(1<<bit))
    {
        if(node->left!=NULL)
        {
            ans=Query(node->left,x,bit-1);
        }
        else
        {
            ans=Query(node->right,x,bit-1);
        }

    }
    else
    {
        if(node->right!=NULL)
        {
            ans=Query(node->right,x,bit-1);
        }
        else
        {
            ans=Query(node->left,x,bit-1);
        }
    }
    return ans;
}
int main()
{
    long long i,ans,x,m=0,out=0;
    root=createNode();
    scanf("%lld",&n);
    scanf("%lld",&a[0]);
    for(i=1;i<n;i++)
    {
        scanf("%lld",&a[i]);
        a[i]=a[i]^a[i-1];
    }
    x=0;
    Insert(root,0,39);
    for(i=0;i<n;i++)
    {
        //x=x^a[i];
        Insert(root,a[i],39);
        ans=Query(root,a[i],39);
        ans=ans^a[i];
        m=max(m,ans);
        left[i]=m;
    }
    root=createNode();
    x=0;m=0;
    Insert(root,0,39);
    for(i=n-1;i>=0;i--)
    {
        x=a[i-1]^a[n-1];
        Insert(root,x,39);
        ans=Query(root,x,39);
        ans=ans^x;
        m=max(m,ans);
        right[i]=m;
    }
    for(i=0;i<n-1;i++)
    {
        out=max(out,(left[i]^right[i+1]));
    }
    printf("%lld\n",out);
    return 0;
}


#include<stdio.h>
#define max(a,b) a>b?a:b
struct TreeNode
{
    struct TreeNode *left;
    struct TreeNode *right;
    long long value;

};
typedef struct TreeNode TreeNode;
long long n,a[100007];
TreeNode *root;
TreeNode* createNode()
{
    TreeNode *t=(TreeNode*)malloc(sizeof(TreeNode));
    t->left=NULL;
    t->right=NULL;
    t->value=-1;
    return t;
}
void Insert(TreeNode *node,long long x,int bit)
{
    if(bit==-1)
    {
        node->value=x;
        return;
    }
    if(x&(1<<bit))
    {
        if(node->right==NULL)
        {
            node->right=createNode();
        }
        Insert(node->right,x,bit-1);
    }
    else
    {
        if(node->left==NULL)
        {
            node->left=createNode();
        }
        Insert(node->left,x,bit-1);
    }
}
long long Query(TreeNode *node,long long x,int bit)
{
    if(bit==-1)
    {
        return node->value;
    }
    long long ans=0;
    if(x&(1<<bit))
    {
        if(node->left!=NULL)
        {
            ans=Query(node->left,x,bit-1);
        }
        else
        {
            ans=Query(node->right,x,bit-1);
        }

    }
    else
    {
        if(node->right!=NULL)
        {
            ans=Query(node->right,x,bit-1);
        }
        else
        {
            ans=Query(node->left,x,bit-1);
        }
    }
    return ans;
}
int main()
{
    long long i,ans,x,m=0;
    root=createNode();
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    x=0;
    Insert(root,0,39);
    for(i=0;i<n;i++)
    {
        x=x^a[i];
        Insert(root,x,39);
        ans=Query(root,x,39);
        ans=ans^x;
        m=max(m,ans);
    }
    printf("%lld\n",m);
    return 0;
}


#include <iostream>
#include<vector>
using namespace std;
typedef long long LL;
struct Tnode{
	Tnode *nextZero;
	Tnode *nextOne;
	Tnode ():nextZero(NULL),nextOne(NULL){}
};

class tireBit{
public:
    Tnode head;
	void insertNum(LL num);
	LL findMaxXor(LL num);
};
void tireBit::insertNum(LL num){
	Tnode *temp = &head;
	LL modenum = (1LL)<<62 ;

	for (int i=0;i<63;i++){
		int curBit = (num&modenum)>>(62-i);
		modenum = modenum>>1;
		if (curBit){
			if (temp->nextOne==NULL)
				temp->nextOne = new Tnode();
			temp = temp->nextOne;
		}
		else{
			if (temp->nextZero==NULL)
				temp->nextZero = new Tnode();
			temp = temp->nextZero;
		}

	}
}
LL tireBit::findMaxXor(LL num){
	Tnode *temp = &head;
	LL modenum =(1LL)<<62;
	LL maxorNum = 0;
	for (int i=0;i<63;i++){
		int curBit = (num&modenum)>>(62-i);

		if (curBit){
			if (temp->nextZero)
				temp = temp->nextZero;
			else if(temp->nextOne){
				temp = temp->nextOne;
				maxorNum = maxorNum^modenum;
			}
			else
				break;
		}
		else{
			if (temp->nextOne){
				temp = temp->nextOne;

				maxorNum = maxorNum^modenum;
			}
			else if(temp->nextZero)
				temp = temp->nextZero;
			else
				break;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
   while(cin>>n){

   vector<LL> nums(n);
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	   cin>>nums[i];
	   xorAll = xorAll^nums[i];
   }
   maxRe = xorAll;
   tireBit TB= tireBit();
   TB.insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur = insertCur^nums[i];
	   TB.insertNum(insertCur);
	   xorCur = xorCur^nums[i];
	   maxRe = max(maxRe, TB.findMaxXor(xorCur));

   }
   cout<<maxRe<<endl;
   }
   system("pause");
}


#include <IOSTREAM>
#include<vector>
using namespace std;
typedef long long LL;
struct Tnode{
	Tnode *nextZero;
	Tnode *nextOne;
	Tnode ():nextZero(NULL),nextOne(NULL){}
};

class tireBit{
public:
    Tnode head;
	void insertNum(LL num);
	LL findMaxXor(LL num);
};
void tireBit::insertNum(LL num){
	Tnode *temp = &head;
	LL modenum = (1LL)<<42 ;

	for (int i=0;i<43;i++){
		int curBit = (num&modenum)>>(42-i);
		modenum = modenum>>1;
		if (curBit){
			if (temp->nextOne==NULL)
				temp->nextOne = new Tnode();
			temp = temp->nextOne;
		}
		else{
			if (temp->nextZero==NULL)
				temp->nextZero = new Tnode();
			temp = temp->nextZero;
		}

	}
}
LL tireBit::findMaxXor(LL num){
	Tnode *temp = &head;
	LL modenum =(1LL)<<42;
	LL maxorNum = 0;
	for (int i=0;i<43;i++){
		int curBit = (num&modenum)>>(42-i);

		if (!temp->nextOne ||(curBit && temp->nextZero)){
			temp = temp->nextZero;

		}
		else{
			temp = temp->nextOne;
			maxorNum = maxorNum^modenum;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   cin>>n;
   vector<LL> nums(n);
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	   cin>>nums[i];
	   xorAll = xorAll^nums[i];
   }
   maxRe = xorAll;
   tireBit TB= tireBit();
   TB.insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur = insertCur^nums[i];
	   TB.insertNum(insertCur);
	   xorCur = xorCur^nums[i];
	   maxRe = max(maxRe, TB.findMaxXor(xorCur));

   }
   cout<<maxRe<<endl;
  // }
  // system("pause");
}


#include <IOSTREAM>
#include<vector>
using namespace std;
typedef long long LL;
struct Tnode{
	Tnode *nextZero;
	Tnode *nextOne;
	Tnode ():nextZero(NULL),nextOne(NULL){}
};

class tireBit{
public:
    Tnode head;
	void insertNum(LL num);
	LL findMaxXor(LL num);
};
void tireBit::insertNum(LL num){
	Tnode *temp = &head;
	LL modenum = (1LL)<<62 ;

	for (int i=0;i<63;i++){
		int curBit = (num&modenum)>>(62-i);
		modenum = modenum>>1;
		if (curBit){
			if (temp->nextOne==NULL)
				temp->nextOne = new Tnode();
			temp = temp->nextOne;
		}
		else{
			if (temp->nextZero==NULL)
				temp->nextZero = new Tnode();
			temp = temp->nextZero;
		}

	}
}
LL tireBit::findMaxXor(LL num){
	Tnode *temp = &head;
	LL modenum =(1LL)<<62;
	LL maxorNum = 0;
	for (int i=0;i<63;i++){
		int curBit = (num&modenum)>>(62-i);

		if (curBit){
			if (temp->nextZero)
				temp = temp->nextZero;
			else if(temp->nextOne){
				temp = temp->nextOne;
				maxorNum = maxorNum^modenum;
			}
			else
				break;
		}
		else{
			if (temp->nextOne){
				temp = temp->nextOne;

				maxorNum = maxorNum^modenum;
			}
			else if(temp->nextZero)
				temp = temp->nextZero;
			else
				break;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
   while(cin>>n){

   vector<LL> nums(n);
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	   cin>>nums[i];
	   xorAll = xorAll^nums[i];
   }
   maxRe = xorAll;
   tireBit TB= tireBit();
   TB.insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur = insertCur^nums[i];
	   TB.insertNum(insertCur);
	   xorCur = xorCur^nums[i];
	   maxRe = max(maxRe, TB.findMaxXor(xorCur));

   }
   cout<<maxRe<<endl;
   }
   system("pause");
}


#include <stdio.h>
#include<vector>
using namespace std;
typedef long long LL;
const int N = 100002;
int TireTree[41*N][2] = {0};
int curDepth = 1;

void insertNum(LL num){
	LL modenum = (1LL)<<40 ;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);
		modenum = modenum>>1;
		if (TireTree[temp][curBit]==0)
				TireTree[temp][curBit] = curDepth++;
		temp = TireTree[temp][curBit] ;

	}
}
LL findMaxXor(LL num){
	LL modenum =(1LL)<<40;
	LL maxorNum = 0;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);

		if (TireTree[temp][1]==0 ||(curBit && TireTree[temp][0]!=0)){
			temp = TireTree[temp][0];

		}
		else{
			temp = TireTree[temp][1];
			maxorNum = maxorNum^modenum;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   scanf("%d", &n);
   vector<LL> nums(n);
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	    scanf("%I64d", &nums[i]);
	   xorAll ^= nums[i];
   }
   maxRe = xorAll;
   insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur ^= nums[i];
	   insertNum(insertCur);
	   xorCur ^= nums[i];
	   maxRe = max(maxRe, findMaxXor(xorCur));
   }

    printf("%I64d\n", maxRe);
  // }
   //system("pause");
}


Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "teq", "teq\teq.vcxproj", "{FC7260BF-090F-4410-A6A8-8B4EDB603CE9}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{FC7260BF-090F-4410-A6A8-8B4EDB603CE9}.Debug|Win32.ActiveCfg = Debug|Win32
		{FC7260BF-090F-4410-A6A8-8B4EDB603CE9}.Debug|Win32.Build.0 = Debug|Win32
		{FC7260BF-090F-4410-A6A8-8B4EDB603CE9}.Release|Win32.ActiveCfg = Release|Win32
		{FC7260BF-090F-4410-A6A8-8B4EDB603CE9}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


#include <IOSTREAM>
#include<vector>
using namespace std;
typedef long long LL;
struct Tnode{
	Tnode *nextZero;
	Tnode *nextOne;
	Tnode ():nextZero(NULL),nextOne(NULL){}
};

class tireBit{
public:
    Tnode head;
	void insertNum(LL num);
	LL findMaxXor(LL num);
};
void tireBit::insertNum(LL num){
	Tnode *temp = &head;
	LL modenum = (1LL)<<42 ;

	for (int i=0;i<43;i++){
		int curBit = (num&modenum)>>(42-i);
		modenum = modenum>>1;
		if (curBit){
			if (temp->nextOne==NULL)
				temp->nextOne = new Tnode();
			temp = temp->nextOne;
		}
		else{
			if (temp->nextZero==NULL)
				temp->nextZero = new Tnode();
			temp = temp->nextZero;
		}

	}
}
LL tireBit::findMaxXor(LL num){
	Tnode *temp = &head;
	LL modenum =(1LL)<<42;
	LL maxorNum = 0;
	for (int i=0;i<43;i++){
		int curBit = (num&modenum)>>(42-i);

		if (curBit){
			if (temp->nextZero)
				temp = temp->nextZero;
			else if(temp->nextOne){
				temp = temp->nextOne;
				maxorNum = maxorNum^modenum;
			}
			else
				break;
		}
		else{
			if (temp->nextOne){
				temp = temp->nextOne;

				maxorNum = maxorNum^modenum;
			}
			else if(temp->nextZero)
				temp = temp->nextZero;
			else
				break;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   cin>>n;
   vector<LL> nums(n);
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	   cin>>nums[i];
	   xorAll = xorAll^nums[i];
   }
   maxRe = xorAll;
   tireBit TB= tireBit();
   TB.insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur = insertCur^nums[i];
	   TB.insertNum(insertCur);
	   xorCur = xorCur^nums[i];
	   maxRe = max(maxRe, TB.findMaxXor(xorCur));

   }
   cout<<maxRe<<endl;
  // }
  // system("pause");
}


#include <stdio.h>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long LL;
const int N = 100002;
int TireTree[41*N][2] = {0};
int curDepth = 1;

void insertNum(LL num){
	LL modenum = (1LL)<<40 ;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);
		modenum = modenum>>1;
		if (TireTree[temp][curBit]==0)
				TireTree[temp][curBit] = curDepth++;
		temp = TireTree[temp][curBit] ;

	}
}
LL findMaxXor(LL num){
	LL modenum =(1LL)<<40;
	LL maxorNum = 0;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);

		if (TireTree[temp][1]==0 ||(curBit && TireTree[temp][0]!=0)){
			temp = TireTree[temp][0];

		}
		else{
			temp = TireTree[temp][1];
			maxorNum = maxorNum^modenum;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   scanf("%d", &n);
   LL nums[N];
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	    scanf("%I64d", &nums[i]);
	   xorAll ^= nums[i];
   }
   maxRe = xorAll;
   insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur ^= nums[i];
	   insertNum(insertCur);
	   xorCur ^= nums[i];
	   maxRe = max(maxRe, findMaxXor(xorCur));
   }

    printf("%I64d\n", maxRe);
  // }
}


#include <stdio.h>

#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)
typedef long long LL;
const int N = 100002;
int TireTree[41*100002][2] = {0};
int curDepth = 1;

void insertNum(LL num){
	LL modenum = (1LL)<<40 ;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);
		modenum = modenum>>1;
		if (TireTree[temp][curBit]==0)
				TireTree[temp][curBit] = curDepth++;
		temp = TireTree[temp][curBit] ;

	}
}
LL findMaxXor(LL num){
	LL modenum =(1LL)<<40;
	LL maxorNum = 0;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);

		if (TireTree[temp][1]==0 ||(curBit && TireTree[temp][0]!=0)){
			temp = TireTree[temp][0];

		}
		else{
			temp = TireTree[temp][1];
			maxorNum = maxorNum^modenum;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   scanf("%d", &n);
   LL nums[N];
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	    scanf("%I64d", &nums[i]);
	   xorAll ^= nums[i];
   }
   maxRe = xorAll;
   insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur ^= nums[i];
	   insertNum(insertCur);
	   xorCur ^= nums[i];
	   maxRe = max(maxRe, findMaxXor(xorCur));
   }

    printf("%I64d\n", maxRe);
  // }
}


#include <stdio.h>

#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)
typedef long long LL;
const int N = 100002;
int TireTree[41*N][2] = {0};
int curDepth = 1;

void insertNum(LL num){
	LL modenum = (1LL)<<40 ;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);
		modenum = modenum>>1;
		if (TireTree[temp][curBit]==0)
				TireTree[temp][curBit] = curDepth++;
		temp = TireTree[temp][curBit] ;

	}
}
LL findMaxXor(LL num){
	LL modenum =(1LL)<<40;
	LL maxorNum = 0;
	int temp = 0;
	for (int i=0;i<41;i++){
		int curBit = (num&modenum)>>(40-i);

		if (TireTree[temp][1]==0 ||(curBit && TireTree[temp][0]!=0)){
			temp = TireTree[temp][0];

		}
		else{
			temp = TireTree[temp][1];
			maxorNum = maxorNum^modenum;
		}
		modenum = modenum>>1;
	}
	return maxorNum^num;
}

int main(){
   int n;
   LL maxRe ;
  // while(cin>>n){
   scanf("%d", &n);
   LL nums[N];
   LL xorAll = 0;
   for (int i =0; i<n;i++){
	    scanf("%I64d", &nums[i]);
	   xorAll ^= nums[i];
   }
   maxRe = xorAll;
   insertNum(0LL);
   LL xorCur = xorAll;
   LL insertCur = 0;
   for (int i = 0;i < n; i++){
	   insertCur ^= nums[i];
	   insertNum(insertCur);
	   xorCur ^= nums[i];
	   maxRe = max(maxRe, findMaxXor(xorCur));
   }

    printf("%I64d\n", maxRe);
  // }
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)
typedef struct tries
{
	struct tries *one,*zero;
}tries;
void initialize(tries *root)
{
	root->one=NULL;
	root->zero=NULL;
}
void insert(tries *root,long long x,long long pos)
{
	if(pos==-1)
		return ;
	if((x>>pos)&1)
	{
		if(!(root->one))
			root->one=(tries *)malloc(sizeof(tries));
		insert(root->one,x,pos-1);
	}
	else
	{
		if(!(root->zero))
			root->zero=(tries *)malloc(sizeof(tries));
		insert(root->zero,x,pos-1);
	}
}
long long query(tries *root,long long x,long long pos)
{
	if(pos==-1)
		return 0;
	if((x>>pos)&1)
	{
		if(root->zero)
		{
			long long ret=(long long)((long long)(1) << (long long)pos);
			return (ret+query(root->zero,x,pos-1));
		}
		else
			return (query(root->one,x,pos-1));
	}
	else
	{
		if(root->one)
		{
			long long ret=(long long)((long long)(1) << (long long)pos);
			return (ret+query(root->one,x,pos-1));
		}
		else
			return (query(root->zero,x,pos-1));
	}

}
int main()
{
	long long int n,i,pre,suf,ans,a[100009];
	scanf("%lld",&n);
	pre=0;
	ans=0;
	tries *root=(tries *)malloc(sizeof(tries));
	insert(root,0,60);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		pre=pre^a[i];
	}
	suf=0;
	ans=pre;
	for(i=n-1;i>=0;i--)
	{
		suf^=a[i];
		pre^=a[i];
		insert(root,suf,60);
		ans=max(ans,query(root,pre,60));
	}
	printf("%lld\n",ans);
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)
typedef struct tries
{
	struct tries *one,*zero;
}tries;
void initialize(tries *root)
{
	root->one=NULL;
	root->zero=NULL;
}
void insert(tries *root,long long x,long long pos)
{
	if(pos==-1)
		return ;
	if((x>>pos)&1)
	{
		if(!(root->one))
		{
			root->one=(tries *)malloc(sizeof(tries));
			initialize(root->one);
		}
		insert(root->one,x,pos-1);
	}
	else
	{
		if(!(root->zero))
		{
			root->zero=(tries *)malloc(sizeof(tries));
			initialize(root->zero);
		}
		insert(root->zero,x,pos-1);
	}
}
long long query(tries *root,long long x,long long pos)
{
	if(pos==-1)
		return 0;
	if((x>>pos)&1)
	{
		if(root->zero)
		{
			long long ret=(long long)((long long)(1) << (long long)pos);
			return (ret+query(root->zero,x,pos-1));
		}
		else
			return (query(root->one,x,pos-1));
	}
	else
	{
		if(root->one)
		{
			long long ret=(long long)((long long)(1) << (long long)pos);
			return (ret+query(root->one,x,pos-1));
		}
		else
			return (query(root->zero,x,pos-1));
	}

}
int main()
{
	long long int n,i,pre,suf,ans,a[100009];
	scanf("%lld",&n);
	pre=0;
	tries *root=(tries *)malloc(sizeof(tries));
	initialize(root);
	insert(root,0,60);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		pre=pre^a[i];
	}
	suf=0;
	ans=pre;
	for(i=n-1;i>=0;i--)
	{
		suf^=a[i];
		pre^=a[i];
		insert(root,suf,60);
		ans=max(ans,query(root,pre,60));
	}
	printf("%lld\n",ans);
	return 0;
}


// Problem : E. Sausage Maximization
// Contest : Codeforces - Codeforces Round #173 (Div. 2)
// URL : https://codeforces.com/contest/282/problem/E
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class a implements Runnable{

    public static void main(String[] args) {
        new Thread(null, new a(), "process", 1<<26).start();
    }
	public void run() {
		FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		//PrintWriter out = new PrintWriter("file.out");
		Task solver = new Task();
		//int t = scan.nextInt();
		int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {
		static final int inf = Integer.MAX_VALUE;

		public void solve(int testNumber, FastReader sc, PrintWriter pw) {
			//CHECK FOR QUICKSORT TLE
			//***********************//
			//CHECK FOR INT OVERFLOW
			//***********************//
			int n = sc.nextInt();
			long[] arr = new long[n];
			node cent = new node(0);
			for(int i = 0; i < n; i++) {
				arr[i] = sc.nextLong();
			}
			long max = 0;
			long cuxor = 0;
			long[] cxsr = new long[n];
			cxsr[n - 1] = arr[n - 1];
			for(int i = n - 2; i >= 0; i--) {
				cxsr[i] = arr[i] ^ cxsr[i + 1];
			}
			node currs = cent;
			for(int i = 0; i < 39; i++) {
				currs.zr = new node(39 - i);
				currs = currs.zr;
			}
			for(int k = 0; k <= n; k++) {
				node curr = cent;
				if(k > 0) {
					long chk = cxsr[k - 1];
					max = Math.max(chk, max);
					curr = cent;
					long c = (1l<<40) - 1;
					for(int i = 39; i >= 0; i--) {
						if((chk & (1l<<i)) > 0) {
							if(curr.zr == null) {
								curr = curr.on;
								c -= (1l<<i);
							}
							else curr = curr.zr;
						}
						else {
							if(curr.on == null) {
								curr = curr.zr;
								c -= (1l<<i);
							}
							else curr = curr.on;
						}
					}
					//pw.println(c);
					max = Math.max(max, c);
				}
				if(k == n) break;
				cuxor ^= arr[k];
				max = Math.max(cuxor, max);
				curr = cent;
				for(int i = 39; i >= 0; i--) {
					if((cuxor & (1l<<i)) > 0) {
						if(curr.on == null) curr.on = new node(i);
						curr = curr.on;
					}
					else {
						if(curr.zr == null) curr.zr = new node(i);
						curr = curr.zr;
					}
				}
			}
			pw.println(Math.max(cuxor, max));
		}
	}
	static class node {
		node zr;
		node on;
		int val;
		node(int a) {
			val = a;
		}
		public String toString(){
			return "" + val;
		}
	}
	static long binpow(long a, long b, long m) {
		a %= m;
		long res = 1;
		while (b > 0) {
			if ((b & 1) == 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
	}
	static void sort(int[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static void sort(long[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static class tup implements Comparable<tup>{
		int a, b;
		tup(int a,int b){
			this.a=a;
			this.b=b;
		}
		@Override
		public int compareTo(tup o){
			return Integer.compare(o.b,b);
		}
	}
	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(i + 1);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(i + 1);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int length = in.nextInt();
        Long prefix = 0L;
        Long suffix = 0L;
        Long res = 0L;
        int[] arr = new int[100010];
        for (int i = 1; i <= length; i++) {
            arr[i] = in.nextInt();
            suffix ^= arr[i];
        }
        Trie trie = new Trie();
        for (int i = 1; i <= length + 1; i++) {
            trie.insertPrefix(prefix);
            Long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(Long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    Long getMaxPrefix(Long val) {
        Long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int length = 0;
        long prefix = 0;
        long suffix = 0L;
        long res = 0L;
        long[] arr = new long[100000];
        try {
            String sLength = in.readLine();
            length = Integer.parseInt(sLength);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            String sNum = in.readLine();
            String[] sArr = sNum.split(" ");
            for (int i = 0; i < sArr.length; i++) {
                arr[i] = Long.parseLong(sArr[i]);
                suffix ^= arr[i];
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        Trie trie = new Trie();
        for (int i = 1; i <= length + 1; i++) {
            trie.insertPrefix(prefix);
            long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    long getMaxPrefix(long val) {
        long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {

        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s = null;
        try {
            s = input.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        int n = Integer.parseInt(s);
        try {
            s = input.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String[] sArr = s.split(" ");

        long[] nums = new long[n];
        long suffix = 0L;
        long max = 0L;
        long prefix = 0L;
        int len = nums.length;

        for (int i = 0; i < n; ++i) {
            nums[i] = Long.parseLong(sArr[i]);
            suffix ^= nums[i];
        }

        Trie trie = new Trie(len + 1);
        trie.insertPrefix(0L);
        for (int i = 0; i < len; ++i) {
            prefix ^= nums[i];
            suffix ^= nums[i];
            trie.insertPrefix(prefix);
            long tmp = trie.getMax(suffix);
            max = Math.max(max, tmp ^ suffix);
        }
        System.out.println(max);
    }
}

class Trie {

    private TrieNode[] nodes;
    private int total;

    public Trie(int len) {
        nodes = new TrieNode[50 * len];
        nodes[0] = new TrieNode();
        total = 1;
    }

    class TrieNode {
        int[] next = new int[2];

        public TrieNode() {
            next[0] = -1;
            next[1] = -1;
        }
    }

    public void insertPrefix(long value) {
        for (int i = 49, u = 0; i >= 0; i--) {
            int bit = 0;
            if (((1L << i) & value) != 0) {
                bit = 1;
            }
            if (nodes[u].next[bit] == -1) {
                nodes[total] = new TrieNode();
                nodes[u].next[bit] = total++;
            }
            u = nodes[u].next[bit];
        }
    }

    public long getMax(long value) {
        long res = 0L;
        for (int i = 49, u = 0; i >= 0; i--) {
            int bit = 0;
            if (((1L << i) & value) == 0) {
                bit = 1;
            }
            if (nodes[u].next[bit] == -1){
                bit ^= 1;
            }
            res = (res << 1) + (long) bit;
            u = nodes[u].next[bit];
        }
        return res;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int length = 0;
        long prefix = 0;
        long suffix = 0L;
        long res = 0L;
        long[] arr = new long[100000];
        try {
            String sLength = in.readLine();
            length = Integer.parseInt(sLength);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            String sNum = in.readLine();
            String[] sArr = sNum.split(" ");
            for (int i = 0; i <= length; i++) {
                arr[i] = Long.parseLong(sArr[i]);
                suffix ^= arr[i];
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        Trie trie = new Trie();
        for (int i = 1; i <= length + 1; i++) {
            trie.insertPrefix(prefix);
            long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    long getMaxPrefix(long val) {
        long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int size = in.nextInt();
        long[] arr = new long[size];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = in.nextInt();
        }

        long max = 0L;
        for (int i = -1; i < size; i++) {
            int prefix = xor(arr, 0, i);
            for (int j = i + 1; j < size; j++) {
                int suffix = xor(arr, j, size - 1);
                int tmp = prefix ^ suffix;
                max = Math.max(max, tmp);
            }
            if (i == size - 1) {
                max = Math.max(prefix, max);
            }
        }

        System.out.println(max);
    }

    public static int xor(int[] arr, int start, int end) {
        if (start > end) return 0;
        int res = arr[start];
        for (int i = start + 1; i <= end; i++) {
            res ^= arr[i];
        }

        return res;
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int length = in.nextInt();
        Long prefix = 0L;
        Long suffix = 0L;
        Long res = 0L;
        Long[] arr = new Long[100010];
        for (int i = 1; i <= length; i++) {
            arr[i] = in.nextLong();
            suffix ^= arr[i];
        }
        Trie trie = new Trie();
        for (int i = 1; i <= length + 1; i++) {
            trie.insertPrefix(prefix);
            Long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(Long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    Long getMaxPrefix(Long val) {
        Long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int length = in.nextInt();
        long prefix = 0;
        long suffix = 0L;
        long res = 0L;
        long[] arr = new long[100010];
        for (int i = 1; i <= length; i++) {
            arr[i] = in.nextLong();
            suffix ^= arr[i];
        }
        Trie trie = new Trie();
        for (int i = 1; i <= length + 1; i++) {
            trie.insertPrefix(prefix);
            long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    long getMaxPrefix(long val) {
        long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int length = 0;
        long prefix = 0;
        long suffix = 0L;
        long res = 0L;
        long[] arr = new long[100000];
        try {
            String sLength = in.readLine();
            length = Integer.parseInt(sLength);
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            String sNum = in.readLine();
            String[] sArr = sNum.split(" ");
            for (int i = 0; i < sArr.length; i++) {
                arr[i] = Long.parseLong(sArr[i]);
                suffix ^= arr[i];
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        Trie trie = new Trie();
        for (int i = 0; i <= length; i++) {
            trie.insertPrefix(prefix);
            long tmp = trie.getMaxPrefix(suffix);
            res = Math.max(res, (tmp ^ suffix));
            prefix ^= arr[i];
            suffix ^= arr[i];
        }
        System.out.println(res);
    }
}

class TrieNode {
    int key;
    TrieNode children[] = new TrieNode[2];

    public TrieNode() {
        children[0] = null;
        children[1] = null;
        key = 0;
    }
}

class Trie {
    TrieNode root = new TrieNode();
    void insertPrefix(long val) {
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id] == null) {
                TrieNode p = new TrieNode();
                p.key = id;
                node.children[id] = p;
            }
            node = node.children[id];
        }
    }

    long getMaxPrefix(long val) {
        long res = 0L;
        TrieNode node = root;
        for (int i = 50; i >= 0; i--) {
            int id = 0;
            if (((1L << i) & val) > 0) {
                id = 1;
            }
            if (node.children[id ^ 1] != null) {
                node = node.children[id ^ 1];
            } else {
                node = node.children[id];
            }
            res += (1L << i) * node.key;
        }
        return res;
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main{
	static Trie root=new Trie();
	public static void main(String[] args){
		Scanner in=new Scanner(System.in);
		 while(in.hasNext()){
			 long start=System.currentTimeMillis();
			 int len=Integer.parseInt(in.nextLine());
			 String[] num=(String[])in.nextLine().split(" ");
			 long temp=0;
		     long[] nums=new long[len];
		     for(int i=0;i<nums.length;i++){
		    	 nums[i]=Long.parseLong(num[i]);
		    	 temp^=nums[i];
		    	 insert(temp);
		     }
		     long ans=len==1?0:nums[0];
		     temp=0;
		     for(int i=0;i<len;i++){
		    	 temp^=nums[len-i-1];
		    	 ans=Math.max(ans,match(temp));
		     }
		     root=new Trie();
		     long end=System.currentTimeMillis();
		     System.out.print("  "+ans+"\n"+"time  "+(end-start));
		 }
	}
	public static void insert(long n){
		Trie p=root;
		for(int i=63;i>=0;i--){
			int id=(int)(n>>i)&1;
			if(p.next[id]==null)
				p.next[id]=new Trie();
			p=p.next[id];
		}
	}
	public static long match(long temp){
		temp=~temp;
		long ans=0;
		Trie p=root;
		for(int i=63;i>=0;i--){
			ans<<=1;
			long bit=(temp>>i)&1;
			if(bit==1){
				if(p.next[1]!=null){
					p=p.next[1];
					ans++;
				}
				else
					p=p.next[0];
			}
			else{
				if(p.next[0]!=null){
					p=p.next[0];
					ans++;
				}
				else
					p=p.next[1];
			}
		}
		return ans;
	}
}
class Trie{
	public Trie[] next=new Trie[2];
	Trie(){
		this.next[0]=null;
		this.next[1]=null;
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        private int numNodes;
        private int[][] move;

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n];
            move = new int[2][(n + 1) * 64];
            for (int[] arr : move) {
                Arrays.fill(arr, -1);
            }
            long suffix = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
                suffix ^= a[i];
            }
            int prefixesTrie = numNodes++;
            add(prefixesTrie, 0);
            long prefix = 0;
            long ans = 0;
            for (int suffixStart = 0; ; suffixStart++) {
                ans = Math.max(ans, findMax(prefixesTrie, suffix));
                if (suffixStart == n) {
                    break;
                }
                prefix ^= a[suffixStart];
                suffix ^= a[suffixStart];
                add(prefixesTrie, prefix);
            }
            out.println(ans);
        }

        private void add(int root, long s) {
            int node = root;
            for (int bit = 63; bit >= 0; bit--) {
                int c = (int) ((s >> bit) & 1);
                if (move[c][node] < 0) {
                    move[c][node] = numNodes++;
                }
                node = move[c][node];
            }
        }

        private long findMax(int root, long x) {
            int node = root;
            long res = 0;
            for (int bit = 63; bit >= 0; bit--) {
                int c = (int) ((x >> bit) & 1);
                if (move[1 - c][node] >= 0) {
                    node = move[1 - c][node];
                    res |= 1L << bit;
                } else {
                    node = move[c][node];
                }
            }
            return res;
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.IOException;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) throws IOException{
		 Scanner in =new Scanner(System.in);
		 while(in.hasNext()){
			 String  length=in.nextLine();
			 String[] num=(String[])in.nextLine().split(" ");
			 int len=Integer.parseInt(length);
		     int[] nums=new int[num.length];
		     for(int i=0;i<nums.length;i++)
		    	 nums[i]=Integer.parseInt(num[i]);
			System.out.println(getMax(nums));
		 }
	}
	public static int getMax(int[] nums){
		int[] temp=new int[nums.length];
		temp[0]=0;
		int max=0;
		for(int i=1;i<nums.length;i++){
			temp[i]=temp[i-1]^nums[nums.length-i];
			if(max<temp[i])
				max=temp[i];
		}
		for(int i=0;i<nums.length;i++){
			for(int j=0;j<nums.length-i;j++){
					temp[j]=temp[j]^nums[i];
					if(max<temp[j])
						max=temp[j];
			}
		}
		return max;
	}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

#define MAX 100001

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i,c=0;
    cin>>n;
    int a[n+1], b[n+1];
    map <int, int> ma, mb;
    map <int, int> :: iterator it;
    for(i=0;i<n;i++){
        cin>>a[i];
        ma[a[i]]=i;
    }
     for(i=0;i<n;i++){
         cin>>b[i];
         mb[b[i]]=i;
     }
    for(i=0;i<n;i++){
        //cout<<a[i]<<" "<<ma[a[i]]<<" "<<mb[a[i]]<<endl;
        if(ma[a[i]]<mb[a[i]]){
            c++;
        }
    }
    if(c==0)cout<<"0"<<endl,exit(0);
    cout<<n-c;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

#define MAX 100001

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i,c=0, mid, f=0;
    cin>>n;
    int a[n+1], b[n+1];
    map <int, int> ma, mb;
    map <int, int> :: iterator it;
    for(i=0;i<n;i++){
        cin>>a[i];
        ma[a[i]]=i;
    }
     for(i=0;i<n;i++){
         cin>>b[i];
         mb[b[i]]=i;
     }
    for(i=0;i<n;i++){
        //cout<<a[i]<<" "<<ma[a[i]]<<" "<<mb[a[i]]<<endl;
       // cout<<i<<" "<<mb[a[i]]<<endl;
        if(i<=mb[a[i]]){
            c++;
        }
    }
    mid=n/2;
    if(a[mid]==b[mid] && c!=0){
    for(i=0;i<mid;i++){
        if(ma[a[mid]]>mb[a[i]]){
            f=1;break;
        }
    }
}

 if(f==1 && c!=n)c--;

    cout<<n-c;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

#define MAX 100001

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i,c=0, mid, f=0;
    cin>>n;
    int a[n+1], b[n+1];
    map <int, int> ma, mb;
    map <int, int> :: iterator it;
    for(i=0;i<n;i++){
        cin>>a[i];
        ma[a[i]]=i;
    }
     for(i=0;i<n;i++){
         cin>>b[i];
         mb[b[i]]=i;
     }
    for(i=0;i<n;i++){
        //cout<<a[i]<<" "<<ma[a[i]]<<" "<<mb[a[i]]<<endl;
       // cout<<i<<" "<<mb[a[i]]<<endl;
        if(i<=mb[a[i]]){
            c++;
        }
    }
    mid=n/2;
    if(a[mid]==b[mid]){
    for(i=0;i<mid;i++){
        if(ma[a[mid]]>mb[a[i]]){
            f=1;break;
        }
    }
}

 if(f==1 && c!=n)c--;

    cout<<n-c;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

#define MAX 100001

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i, c=0, mx;
    cin>>n;
    int a[n+1], b[n+1];
    map <int, int> mp;
    for(i=0;i<n;i++) cin>>a[i];
    vi v;
     for(i=0;i<n;i++){
         cin>>b[i];
         mp[b[i]]=i;
     }
    for(i=0;i<n;i++) v.pb(mp[a[i]]);
    mx=v[0];
    for(i=0;i<n;i++){
        if(v[i]<mx) c++;
        mx=max(mx,v[i]);
    }

    cout<<c;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit[n];

	bool visited[n];

	for(int i=0;i<n;i++)
		visited[i] = false;

	stack<int>s;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		s.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit[i];

	int ct = 0;

	int start = 0;
	while(!s.empty()&&start<n)
	{
		if(visited[s.top()])
			s.pop();

		if(s.top()!=exit[start])
		{
			ct++;
			visited[exit[start]] = true;
			s.pop();
		}
		else
		{
			s.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit[n];

	bool visited[n];

	for(int i=0;i<n;i++)
		visited[i] = false;

	queue<int>q;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		q.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit[i];

	int ct = 0;

	int start = 0;
	while(!q.empty()&&start<n)
	{
		if(visited[q.front()])
			q.pop();

		if(q.front()!=exit[start])
		{
			ct++;
			visited[exit[start]] = true;
			start++;
		}
		else
		{
			q.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit1[n];

	bool visited[n];

	for(int i=0;i<n;i++)
		visited[i] = false;

	queue<int>q;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		q.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit1[i];

	int ct = 0;

	int start = 0;
	while(!q.empty()&&start<n)
	{
		if(visited[q.front()])
			q.pop();

		if(q.front()!=exit1[start])
		{
			ct++;
			visited[exit1[start]] = true;
			start++;
		}
		else
		{
			q.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit1[n];

	bool visited[n];

	for(int i=0;i<n;i++)
		visited[i] = false;

	queue<int>q;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		q.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit1[i];

	int ct = 0;

	int start = 0;
	while(!q.empty()&&start<n)
	{
	    int fr = q.front();
		if(visited[fr])
			q.pop();

		if(fr!=exit1[start])
		{
			ct++;
			//cout<<fr;
			visited[exit1[start]] = true;
			start++;
		}
		else
		{
			q.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit1[n];

	bool visited[110010];

	for(int i=0;i<n;i++)
		visited[i] = false;

	queue<int>q;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		q.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit1[i];

	int ct = 0;

	int start = 0;
	while(!q.empty()&&start<n)
	{
		if(visited[q.front()])
		{

			q.pop();
			continue;
		}

		if(q.front()!=exit1[start])
		{
		    //cout<<q.front();
			ct++;
			visited[exit1[start]] = true;
			start++;
		}
		else
		{
			q.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin>>n;

	int entry[n];
	int exit1[n];

	bool visited[110010];

	for(int i=0;i<n;i++)
		visited[i] = false;

	queue<int>q;

	for(int i=0;i<n;i++)
	{
		cin>>entry[i];
		q.push(entry[i]);
	}

	for(int i=0;i<n;i++)
		cin>>exit1[i];

	int ct = 0;

	int start = 0;
	while(!q.empty()&&start<n)
	{
		if(visited[q.front()])
			q.pop();

		if(q.front()!=exit1[start])
		{
		    //cout<<q.front();
			ct++;
			visited[exit1[start]] = true;
			start++;
		}
		else
		{
			q.pop();
			start++;
		}
	}

	cout<<ct<<endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define pq_min priority_queue<ll,vector<ll>,greater<ll>>
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define ld long double
#define autt set<ll>::iterator
const ll mod=1e9 + 7;
ll power(ll a,ll b)
{
	a=a%mod;
	ll ans=1;
	while(b>0)
	{
		if(b%2==1)
		{
			ans=(ans*a)%mod;
		}
		b=b/2;
		a=(a*a)%mod;
	}
	return ans;
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   ll n;
   cin>>n;
   ll a[n+1];
   ll b[n+1];
   for(ll i=1;i<=n;i++)
   {
   	  cin>>a[i];
   }
   for(ll i=1;i<=n;i++)
   {
   	  cin>>b[i];
   }
   ll c=0;
   ll t=1;
   map<ll,ll> f;
   for(ll i=1;i<=n;i++)
   {
   	  if(f[a[t]]!=0)
	  {
	  	 t++;
	  	 i--;
	  	 continue;
	  }
   	  if(a[t]==b[i])
   	  {
   	  	 t++;
	  }
	  else
	  {
	  	 f[b[i]]++;
	  	 c++;
	  }
   }
   cout<<c<<endl;

}