#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <cassert>
#include <numeric>
#include <sstream>
using namespace std;

#define REQUIRE(cond, message) \
    do { \
        if (!(cond)) { \
            std::cerr << message << std::endl; \
            assert(false); \
        } \
    } while (false)

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define forv(i, v) forn(i, (v).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef vector<string> vs;
typedef long double ld;

vi toBinary(ll x, int len = 0)
{
    vi ret;
    while (x > 0) {
        ret.pb(x & 1);
        x >>= 1;
    }
    if (len > 0) ret.resize(len);
    reverse(all(ret));
    return ret;
}

const size_t UNDEFINED = std::numeric_limits<size_t>::max();

class Trie
{
public:
    explicit Trie(size_t reserveSize)
    {
        next_.reserve(reserveSize);
        next_.emplace_back(2, UNDEFINED);
    }

    size_t next(size_t id, size_t type) const
    {
        return next_.at(id).at(type);
    }

    size_t add(size_t id, size_t type)
    {
        if (next_.at(id).at(type) == UNDEFINED) {
            next_.at(id).at(type) = next_.size();
            next_.emplace_back(2, UNDEFINED);
        }
        return next_.at(id).at(type);
    }

    size_t root() const { return 0; }

private:
    typedef std::vector<size_t> Children;
    std::vector<Children> next_;
};

void add(Trie& trie, const vi& a)
{
    size_t node = trie.root();
    for (int type : a) {
        node = trie.add(node, type);
    }
}

void solve()
{
    int n;
    cin >> n;
    vl a(n);
    forn(i, n) cin >> a[i];
    int len = toBinary(*max_element(all(a))).size();
    ll suffixXor = accumulate(all(a), 0LL, [](ll a, ll b) { return a ^ b; });
    ll prefixXor = 0;
    ll ans = 0;
    Trie trie(n * len);
    add(trie, vi(len, 0));
    forn(i, n) {
        vi candidate = toBinary(suffixXor, len);
        size_t node = trie.root();
        for (int& type : candidate) {
            if (trie.next(node, type ^ 1) != UNDEFINED) {
                node = trie.next(node, type ^ 1);
                type = 1;
            } else {
                node = trie.next(node, type);
            }
        }
        ll cand = 0;
        for (int c : candidate) {
            cand = cand * 2 + c;
        }
        ans = max(ans, cand);
        suffixXor ^= a[i];
        prefixXor ^= a[i];
        add(trie, toBinary(prefixXor, len));
    }
    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;

struct vertex {
    int next[2], pos;
};

const int N = 100000;
int len = 40;
vertex t[100 * N];
int sz = 1;
ll a[N], L[N], R[N];

void add(ll a, int pos) {
    ll now = 1LL << (len - 1);
    bool s[len];
    for (int i = 0; i < len; i++) {
        s[i] = a & now;
        now >>= 1;
    }
    int v = 0;
    for (int i = 0; i < len; i++) {
        bool c = s[i];
        if (t[v].next[c] == -1) {
            memset(t[sz].next, 255, sizeof(t[sz].next));
            t[v].next[c] = sz++;
        }
        v = t[v].next[c];
        t[v].pos = max(pos, t[v].pos);
    }
}

ll findBest(ll a, int pos) {
    ll now = 1LL << (len - 1);
    bool s[len];
    for (int i = 0; i < len; i++) {
        s[i] = !(a & now);
        now >>= 1;
    }
    int v = 0;
    ll res = 0;
    for (int i = 0; i < len; i++) {
        bool c = s[i];
        res = res * 2 + (t[v].next[c] != -1 && t[t[v].next[c]].pos > pos);
        v = (t[v].next[c] != -1 && t[t[v].next[c]].pos > pos ? t[v].next[c] : t[v].next[!c]);
    }
    return res;
}

int main() {
    // freopen("input.txt", "r", stdin);
    memset(t[0].next, 255, sizeof(t[0].next));
    ll n, ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++) {
        L[i] = (i ? L[i - 1]: 0) ^ a[i];
        ans = max(L[i], ans);
    }
    for (int i = n - 1; i >= 0; i--) {
        R[i] = (i != n - 1 ? R[i + 1] : 0) ^ a[i];
        ans = max(R[i], ans);
        add(R[i], i);
    }
    for (int i = 0; i < n - 1; i++)
        ans = max(findBest(L[i], i), ans);
    cout << ans;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;

struct vertex {
    int next[2];
    int l;
};

const int N = 100000;
int len = 40;
vertex t[100 * N];
int sz = 1;
ll a[N];

void add(ll a, int l) {
    ll now = 1LL << (len - 1);
    bool s[len];
    for (int i = 0; i < len; i++) {
        s[i] = a & now;
        now >>= 1;
    }
    int v = 0;
    for (int i = 0; i < len; i++) {
        bool c = s[i];
        if (t[v].next[c] == -1) {
            memset(t[sz].next, 255, sizeof(t[sz].next));
            t[v].next[c] = sz++;
        }
        v = t[v].next[c];
        t[v].l = max(t[v].l, l);
    }
}

ll findBest(ll a, int r) {
    ll now = 1LL << (len - 1);
    int s[len];
    for (int i = 0; i < len; i++) {
        s[i] = !(a & now);
        now >>= 1;
    }
    int v = 0;
    ll res = 0;
    for (int i = 0; i < len; i++) {
        int c = s[i];
        if (t[v].next[c] != -1 && t[v].l > r) {
            res = res * 2 + c;
            v = t[v].next[c];
        }
        else {
            res = res * 2 + (1 - c);
            v = t[v].next[1 - c];
        }
    }
    return res;
}

int main() {
    // freopen("input.txt", "r", stdin);
    memset(t[0].next, 255, sizeof(t[0].next));
    t[0].next[0] = t[0].next[1] = -1;
    ll n, ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    ll all = 0;
    for (int i = n - 1; i >= 0; i--) {
        all ^= a[i];
        ans = max(ans, all);
        add(all, i);
    }
    ll now = 0;
    for (int i = 0; i < n; i++) {
        now ^= a[i];
        ans = max(ans, now);
        ans = max(ans, now ^ findBest(now, i));
    }
    cout << ans;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

typedef long long ll;

struct vertex {
    int next[2];
};

const int N = 100000;
int len = 40;
vertex t[100 * N];
int sz = 1;
ll a[N], L[N], R[N];

void add(ll a) {
    ll now = 1LL << (len - 1);
    bool s[len];
    for (int i = 0; i < len; i++) {
        s[i] = a & now;
        now >>= 1;
    }
    int v = 0;
    for (int i = 0; i < len; i++) {
        bool c = s[i];
        if (t[v].next[c] == -1) {
            memset(t[sz].next, 255, sizeof(t[sz].next));
            t[v].next[c] = sz++;
        }
        v = t[v].next[c];
    }
}

ll findBest(ll a) {
    ll now = 1LL << (len - 1);
    bool s[len];
    for (int i = 0; i < len; i++) {
        s[i] = !(a & now);
        now >>= 1;
    }
    int v = 0;
    ll res = 0;
    for (int i = 0; i < len; i++) {
        bool c = s[i];
        res = res * 2 + (t[v].next[c] != -1);
        v = (t[v].next[c] != -1 ? t[v].next[c] : t[v].next[!c]);
    }
    return res;
}

int main() {
    // freopen("input.txt", "r", stdin);
    memset(t[0].next, 255, sizeof(t[0].next));
    ll n, ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++) {
        L[i] = (i ? L[i - 1]: 0) ^ a[i];
        ans = max(L[i], ans);
    }
    for (int i = n - 1; i >= 0; i--) {
        R[i] = (i != n - 1 ? R[i + 1] : 0) ^ a[i];
        ans = max(R[i], ans);
    }
    for (int i = n - 1; i > 0; i--) {
        add(R[i]);
        ans = max(findBest(L[i - 1]), ans);
    }
    cout << ans;
    return 0;
}


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

#define SZ(x) ((int)x.size())

struct Trie {
	Trie *ch[2];
	Trie() {
		ch[0] = ch[1] = NULL;
	}
	void insert(long long num, int idx) {
		if(idx == -1) return;
		int i = (num&(1LL<<idx)) > 0;
		if(ch[i] == NULL) ch[i] = new Trie;
		ch[i]->insert(num, idx-1);
	}
	void find(long long num, int idx, long long &ans) {
		if(idx == -1) return;
		if(num & (1LL<<idx)) {
			if(ch[0] != NULL) {
				ans |= (1LL<<idx);
				ch[0]->find(num, idx-1, ans);
				return ;
			}
			ch[1]->find(num, idx-1, ans);
			return;
		}
		if(ch[1] != NULL) {
			ans |= (1LL<<idx);
			ch[1]->find(num, idx-1, ans);
			return ;
		}
		ch[0]->find(num, idx-1, ans);
	}
};

long long arr[100000], prfx[100000], sfx[100000];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

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

	Trie T;
	long long cum = 0;
	for(int i=0; i<n; i++) {
		prfx[i] = cum ^= arr[i];
		T.insert(cum, 50);
	}

	cum = 0;
	long long ans = 0;
	for(int i=n-1; i>=0; i--) {
		long long tmp = 0;
		T.find(cum ^= arr[i],50,tmp);
		ans = max(ans,tmp);
	}
	cout << ans << endl;

	return 0;
}


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

#define SZ(x) ((int)x.size())

struct Trie {
	Trie *ch[2];
	Trie() {
		ch[0] = ch[1] = NULL;
	}
	void insert(long long num, int idx) {
		if(idx == -1) return;
		int i = (num&(1LL<<idx)) > 0;
		if(ch[i] == NULL) ch[i] = new Trie;
		ch[i]->insert(num, idx-1);
	}
	void find(long long num, int idx, long long &ans) {
		if(idx == -1) return;
		if(num & (1LL<<idx)) {
			if(ch[0] != NULL) {
				ans |= (1LL<<idx);
				ch[0]->find(num, idx-1, ans);
				return ;
			}
			ch[1]->find(num, idx-1, ans);
			return;
		}
		if(ch[1] != NULL) {
			ans |= (1LL<<idx);
			ch[1]->find(num, idx-1, ans);
			return ;
		}
		ch[0]->find(num, idx-1, ans);
	}
};

long long arr[100005], prfx[100005], sfx[100005];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n; cin >> n;
	for(int i=1; i<=n; i++) cin >> arr[i];

	Trie T;
	long long cum = 0;
	for(int i=0; i<=n+1; i++) {
		prfx[i] = cum ^= arr[i];
		T.insert(cum, 50);
	}

	cum = 0;
	long long ans = 0;
	for(int i=n+1; i>=0; i--) {
		long long tmp = 0;
		T.find(cum ^= arr[i],50,tmp);
		ans = max(ans,tmp);
	}
	cout << ans << endl;

	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <sstream>
#ifndef ONLINE_JUDGE
#include <codeforces.hpp>
#endif

using namespace std;

typedef pair<long long, int> pli;

const int MAXBITS = 40;

bool nth_bit(long long n, int bit)
{
    return (n >> (MAXBITS - bit)) & 1;
}

void groupByBit(int n, vector<pli>& data, vector<pli>& leftData, vector<pli>& rightData)
{
    leftData.clear();
    rightData.clear();
    for (auto num: data) {
        if (nth_bit(num.first, n)) {
            rightData.push_back(num);
        } else {
            leftData.push_back(num);
        }
    }
}

vector<pli> unique_pair(vector<pli>& data) {
    if (data.size() < 2)
        return data;
    vector<pli> ans;
    sort(data.begin(), data.end());
    for (size_t i = 0; i < data.size() - 1; ++i)
        if (data[i].first != data[i + 1].first)
            ans.push_back(pli(data[i]));
    if (ans.rbegin()->first != data.rbegin()->first)
        ans.push_back(pli(*data.rbegin()));
    return ans;
}

class BinaryTree {
private:
public:
    long long value;
    int maxIdx;
    int nbit;
    int sz;
    BinaryTree* left;
    BinaryTree* right;
    BinaryTree(vector<pli>& data, int bit): value(-1LL), maxIdx(-1), nbit(bit), left(NULL), right(NULL) {
        data = vector<pli>(unique_pair(data));
        if (data.size() == 1) {
            value = data[0].first;
            maxIdx = data[0].second;
            sz = 1;
            data.clear();
            return;
        }
        vector<pli> leftData, rightData;
        while (true) {
            groupByBit(bit, data, leftData, rightData);
            if (!leftData.empty() && !rightData.empty()) {
                data.clear();
                left = new BinaryTree(leftData, bit + 1);
                right = new BinaryTree(rightData, bit + 1);
                maxIdx = max(left->maxIdx, right->maxIdx);
                sz = left->sz + right->sz;
                break;
            } else if (leftData.empty() && !rightData.empty()) {
                data = vector<pli>(unique_pair(rightData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else if (!leftData.empty() && rightData.empty()) {
                data = vector<pli>(unique_pair(leftData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else {
                break;
            }
        }
        if (data.size() == 1) {
            value = data.begin()->first;
            maxIdx = data.begin()->second;
            sz = 1;
            nbit = bit;
        }
    }

    long long maxXor(long long n, int idx) {
        if (!left && !right) {
            if (maxIdx > idx) {
                return value ^ n;
            } else {
                return 0;
            }
        } else {
            bool b = nth_bit(n, left->nbit - 1);
            if (b) {
                if (left->maxIdx > idx) {
                    return left->maxXor(n, idx);
                } else {
                    return right->maxXor(n, idx);
                }
            } else {
                if (right->maxIdx > idx) {
                    return right->maxXor(n, idx);
                } else {
                    return left->maxXor(n, idx);
                }
            }
            return 0;
        }

    }

    void print(string prefix = "") {
        cout << prefix << "sz = " << sz << " nbit = " << nbit;
        if (left) {
            cout << '\n';
            left->print(prefix + "    ");
            cout << '\n';
            right->print(prefix + "    ");
        } else {
            cout << "; value = " << value << '\n';
        }
    }
};

template<typename In, typename Out>
void solve(In& in, Out& out)   //WRITE YOUR SOLUTION HERE
{
    int n;
    in >> n;
    long long x;
    vector<pli> a(n), xorsforward(n), xorsbackward(n);
    for (int i = 0; i < n; ++i) {
        in >> x;
        a[i] = make_pair(x, i);
        if (i == 0) {
            xorsforward[i] = make_pair(x, i);
        } else {
            xorsforward[i] = make_pair(xorsforward[i - 1].first ^ x, i);
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        if (i == n - 1) {
            xorsbackward[i] = make_pair(a[i].first, i);
        } else {
            xorsbackward[i] = make_pair(xorsbackward[i + 1].first ^ a[i].first, i);
        }
    }
    BinaryTree tree(xorsbackward, 0);
    long long ans = 0;
    for (auto i: xorsforward) ans = max(ans, i.first);
    for (auto i: xorsbackward) ans = max(ans, i.first);
    for (auto i: xorsforward) ans = max(ans, tree.maxXor(i.first, i.second));
    out << ans;
}

#ifndef ONLINE_JUDGE
const string testdata[codeforces::MAXTESTS] = { "2\n1 2", "3\n1 2 3", "2\n1000 1000", "10\n1 2 3 4 5 6 7 8 9 10", codeforces::EMPTY };
const string testanswers[codeforces::MAXTESTS] = { "3", "3", "1000", codeforces::EMPTY };
#endif

int main()
{
#ifndef ONLINE_JUDGE
    codeforces::test<solve>(testdata, testanswers);
#else
    solve(cin, cout);
#endif
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <sstream>
#ifndef ONLINE_JUDGE
#include <codeforces.hpp>
#endif

using namespace std;

typedef pair<long long, int> pli;

const int MAXBITS = 40;

bool nth_bit(long long n, int bit)
{
    return (n >> (MAXBITS - bit)) & 1;
}

void groupByBit(int n, vector<pli>& data, vector<pli>& leftData, vector<pli>& rightData)
{
    leftData.clear();
    rightData.clear();
    for (auto num: data) {
        if (nth_bit(num.first, n)) {
            rightData.push_back(num);
        } else {
            leftData.push_back(num);
        }
    }
}

vector<pli> unique_pair(vector<pli>& data) {
    if (data.size() < 2)
        return data;
    vector<pli> ans;
    sort(data.begin(), data.end());
    for (size_t i = 0; i < data.size() - 1; ++i)
        if (data[i].first != data[i + 1].first)
            ans.push_back(pli(data[i]));
    if (ans.empty() || ans.rbegin()->first != data.rbegin()->first) {
        ans.push_back(pli(*data.rbegin()));
    }
    return ans;
}

class BinaryTree {
private:
public:
    long long value;
    int maxIdx;
    int nbit;
    int sz;
    BinaryTree* left;
    BinaryTree* right;
    BinaryTree(vector<pli>& data, int bit): value(-1LL), maxIdx(-1), nbit(bit), left(NULL), right(NULL) {
        data = vector<pli>(unique_pair(data));
        if (data.size() == 1) {
            value = data[0].first;
            maxIdx = data[0].second;
            sz = 1;
            data.clear();
            return;
        }
        vector<pli> leftData, rightData;
        while (true) {
            groupByBit(bit, data, leftData, rightData);
            if (!leftData.empty() && !rightData.empty()) {
                data.clear();
                left = new BinaryTree(leftData, bit + 1);
                right = new BinaryTree(rightData, bit + 1);
                maxIdx = max(left->maxIdx, right->maxIdx);
                sz = left->sz + right->sz;
                break;
            } else if (leftData.empty() && !rightData.empty()) {
                data = vector<pli>(unique_pair(rightData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else if (!leftData.empty() && rightData.empty()) {
                data = vector<pli>(unique_pair(leftData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else {
                break;
            }
        }
        if (data.size() == 1) {
            value = data.begin()->first;
            maxIdx = data.begin()->second;
            sz = 1;
            nbit = bit;
        }
    }

    long long maxXor(long long n, int idx) {
        if (!left && !right) {
            if (maxIdx > idx) {
                return value ^ n;
            } else {
                return 0;
            }
        } else {
            bool b = nth_bit(n, left->nbit - 1);
            if (b) {
                if (left->maxIdx > idx) {
                    return left->maxXor(n, idx);
                } else {
                    return right->maxXor(n, idx);
                }
            } else {
                if (right->maxIdx > idx) {
                    return right->maxXor(n, idx);
                } else {
                    return left->maxXor(n, idx);
                }
            }
            return 0;
        }

    }

    void print(string prefix = "") {
        cout << prefix << "sz = " << sz << " nbit = " << nbit;
        if (left) {
            cout << '\n';
            left->print(prefix + "    ");
            cout << '\n';
            right->print(prefix + "    ");
        } else {
            cout << "; value = " << value << '\n';
        }
    }
};

template<typename In, typename Out>
void solve(In& in, Out& out)   //WRITE YOUR SOLUTION HERE
{
    int n;
    in >> n;
    long long x;
    vector<pli> a(n), xorsforward(n), xorsbackward(n);
    for (int i = 0; i < n; ++i) {
        in >> x;
        a[i] = make_pair(x, i);
        if (i == 0) {
            xorsforward[i] = make_pair(x, i);
        } else {
            xorsforward[i] = make_pair(xorsforward[i - 1].first ^ x, i);
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        if (i == n - 1) {
            xorsbackward[i] = make_pair(a[i].first, i);
        } else {
            xorsbackward[i] = make_pair(xorsbackward[i + 1].first ^ a[i].first, i);
        }
    }
    long long ans = 0;
    for (auto i: xorsforward) ans = max(ans, i.first);
    for (auto i: xorsbackward) ans = max(ans, i.first);
    BinaryTree tree(xorsbackward, 0);
    for (auto i: xorsforward) ans = max(ans, tree.maxXor(i.first, i.second));
    out << ans;
}

#ifndef ONLINE_JUDGE
const string testdata[codeforces::MAXTESTS] = { "2\n1 2", "3\n1 2 3", "2\n1000 1000", "6\n0 0 0 0 0 0", codeforces::EMPTY };
const string testanswers[codeforces::MAXTESTS] = { "3", "3", "1000", "0", codeforces::EMPTY };
#endif

int main()
{
#ifndef ONLINE_JUDGE
    codeforces::test<solve>(testdata, testanswers);
#else
    solve(cin, cout);
#endif
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <sstream>
#ifndef ONLINE_JUDGE
#include <codeforces.hpp>
#endif

using namespace std;

typedef pair<long long, int> pli;

const int MAXBITS = 40;

bool nth_bit(long long n, int bit)
{
    return (n >> (MAXBITS - bit)) & 1;
}

void groupByBit(int n, vector<pli>& data, vector<pli>& leftData, vector<pli>& rightData)
{
    leftData.clear();
    rightData.clear();
for (auto num: data) {
        if (nth_bit(num.first, n)) {
            rightData.push_back(num);
        } else {
            leftData.push_back(num);
        }
    }
}

class BinaryTree {
private:
public:
    long long value;
    int maxIdx;
    int nbit;
    int sz;
    BinaryTree* left;
    BinaryTree* right;
    BinaryTree(vector<pli>& data, int bit): value(-1LL), maxIdx(-1), nbit(bit), left(NULL), right(NULL) {
        sort(data.begin(), data.end());
        data.erase(unique(data.begin(), data.end()), data.end());
        if (data.size() == 1) {
            value = data.begin()->first;
            maxIdx = data.begin()->second;
            sz = 1;
            data.clear();
            return;
        }
        vector<pli> leftData, rightData;
        while (true) {
            groupByBit(bit, data, leftData, rightData);
            if (!leftData.empty() && !rightData.empty()) {
                data.clear();
                left = new BinaryTree(leftData, bit + 1);
                right = new BinaryTree(rightData, bit + 1);
                maxIdx = max(left->maxIdx, right->maxIdx);
                sz = left->sz + right->sz;
                // cout << "ook";
                break;
            } else if (leftData.empty() && !rightData.empty()) {
                data = vector<pli>(rightData.begin(), rightData.end());
                sort(data.begin(), data.end());
                data.erase(unique(data.begin(), data.end()), data.end());
                ++bit;
                if (data.size() == 1) break;
                // cout << "ook2 " << data.size() << '\n';
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else if (!leftData.empty() && rightData.empty()) {
                data = vector<pli>(leftData.begin(), leftData.end());
                sort(data.begin(), data.end());
                data.erase(unique(data.begin(), data.end()), data.end());
                ++bit;
                if (data.size() == 1) break;
                // cout << "ook3 " << data.size() << '\n';
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else {
                break;
            }
        }
        if (data.size() == 1) {
            value = data.begin()->first;
            maxIdx = data.begin()->second;
            sz = 1;
            nbit = bit;
        }
    }

    long long maxXor(long long n, int idx) {
        if (!left && !right) {
            if (maxIdx > idx) {
                return value ^ n;
            } else {
                return 0;
            }
        } else {
            bool b = nth_bit(n, left->nbit - 1);
            if (b) {
                if (left->maxIdx > idx) {
                    return left->maxXor(n, idx);
                } else {
                    return right->maxXor(n, idx);
                }
            } else {
                if (right->maxIdx > idx) {
                    return right->maxXor(n, idx);
                } else {
                    return left->maxXor(n, idx);
                }
            }
            return 0;
        }

    }

    void print(string prefix = "") {
        cout << prefix << "sz = " << sz << " nbit = " << nbit;
        if (left) {
            cout << '\n';
            left->print(prefix + "    ");
            cout << '\n';
            right->print(prefix + "    ");
        } else {
            cout << "; value = " << value << '\n';
        }
    }
};

template<typename In, typename Out>
void solve(In& in, Out& out)   //WRITE YOUR SOLUTION HERE
{
    int n;
    in >> n;
    long long x;
    vector<pli> a(n), xorsforward(n), xorsbackward(n);
    for (int i = 0; i < n; ++i) {
        in >> x;
        a[i] = make_pair(x, i);
        if (i == 0) {
            xorsforward[i] = make_pair(x, i);
        } else {
            xorsforward[i] = make_pair(xorsforward[i - 1].first ^ x, i);
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        if (i == n - 1) {
            xorsbackward[i] = make_pair(a[i].first, i);
        } else {
            xorsbackward[i] = make_pair(xorsbackward[i + 1].first ^ a[i].first, i);
        }
    }
    BinaryTree tree(xorsbackward, 0);
    long long ans = 0;
    for (auto i: xorsforward) ans = max(ans, i.first);
    for (auto i: xorsbackward) ans = max(ans, i.first);
    for (auto i: xorsforward) ans = max(ans, tree.maxXor(i.first, i.second));
    out << ans;
}

#ifndef ONLINE_JUDGE
const string testdata[codeforces::MAXTESTS] = { "2\n1 2", "3\n1 2 3", "2\n1000 1000", codeforces::EMPTY };
const string testanswers[codeforces::MAXTESTS] = { "3", "3", "1000", codeforces::EMPTY };
#endif

int main()
{
#ifndef ONLINE_JUDGE
    codeforces::test<solve>(testdata, testanswers);
#else
    solve(cin, cout);
#endif
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <sstream>
#ifndef ONLINE_JUDGE
#include <codeforces.hpp>
#endif

using namespace std;

typedef long long ll;

class Node
{
    public:
    long long key;
    Node *left, *righ;
    Node(long long num): key(num), left(NULL), righ(NULL) {}
};

template<typename In, typename Out>
void solve(In& in, Out& out)   //WRITE YOUR SOLUTION HERE
{
    int n; in >> n;
    vector<ll> a(n), xors(n), xors_rev(n);
    for (int i = 0; i < n; ++i) { in >> a[i]; }
    auto XOR = [&] (ll i, ll j) { return i ^ j; };
    partial_sum(a.begin(),  a.end(),  xors.begin(),      XOR);
    partial_sum(a.rbegin(), a.rend(), xors_rev.rbegin(), XOR);
    ll ans = 0;
    for (auto i: xors)     ans = max(ans, i);
    for (auto i: xors_rev) ans = max(ans, i);
    Node root(0);
    for (int i = n - 1; i > 0; --i) {
        Node* tmp = &root;
        for (int j = 40; j >= 0; --j) {
            bool bit = (xors_rev[i] >> j) & 1;
            if (bit) { if (!tmp->righ) tmp->righ = new Node(xors_rev[i]); tmp = tmp->righ; }
            else     { if (!tmp->left) tmp->left = new Node(xors_rev[i]); tmp = tmp->left; }
        }
        tmp = &root;
        for (int j = 40; j >= 0; --j) {
            bool bit = (xors[i - 1] >> j) & 1;
            if (bit) { tmp = tmp->left ? tmp->left : tmp->righ; }
            else     { tmp = tmp->righ ? tmp->righ : tmp->left; }
        }
        ans = max(ans, xors[i - 1] ^ tmp->key);
    }
    out << ans;
}

#ifndef ONLINE_JUDGE
const string testdata[codeforces::MAXTESTS] = { "2\n1 2", "3\n1 2 3", "2\n1000 1000", "6\n0 0 0 0 0 0", codeforces::EMPTY };
const string testanswers[codeforces::MAXTESTS] = { "3", "3", "1000", "0", codeforces::EMPTY };
#endif

int main()
{
#ifndef ONLINE_JUDGE
    codeforces::test<solve>(testdata, testanswers);
#else
    solve(cin, cout);
#endif
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <sstream>
#ifndef ONLINE_JUDGE
#include <codeforces.hpp>
#endif

using namespace std;

typedef pair<long long, int> pli;

const int MAXBITS = 40;

bool nth_bit(long long n, int bit)
{
    return (n >> (MAXBITS - bit)) & 1;
}

void groupByBit(int n, vector<pli>& data, vector<pli>& leftData, vector<pli>& rightData)
{
    leftData.clear();
    rightData.clear();
    for (auto num: data) {
        if (nth_bit(num.first, n)) {
            rightData.push_back(num);
        } else {
            leftData.push_back(num);
        }
    }
}

vector<pli> unique_pair(vector<pli>& data) {
    if (data.size() < 2)
        return data;
    vector<pli> ans;
    sort(data.begin(), data.end());
    for (size_t i = 0; i < data.size() - 1; ++i)
        if (data[i].first != data[i + 1].first)
            ans.push_back(pli(data[i]));
    if (ans.rbegin()->first != data.rbegin()->first)
        ans.push_back(pli(*data.rbegin()));
    return ans;
}

class BinaryTree {
private:
public:
    long long value;
    int maxIdx;
    int nbit;
    int sz;
    BinaryTree* left;
    BinaryTree* right;
    BinaryTree(vector<pli>& data, int bit): value(-1LL), maxIdx(-1), nbit(bit), left(NULL), right(NULL) {
        data = vector<pli>(unique_pair(data));
        if (data.size() == 1) {
            value = data[0].first;
            maxIdx = data[0].second;
            sz = 1;
            data.clear();
            return;
        }
        vector<pli> leftData, rightData;
        while (true) {
            groupByBit(bit, data, leftData, rightData);
            if (!leftData.empty() && !rightData.empty()) {
                data.clear();
                left = new BinaryTree(leftData, bit + 1);
                right = new BinaryTree(rightData, bit + 1);
                maxIdx = max(left->maxIdx, right->maxIdx);
                sz = left->sz + right->sz;
                break;
            } else if (leftData.empty() && !rightData.empty()) {
                data = vector<pli>(unique_pair(rightData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else if (!leftData.empty() && rightData.empty()) {
                data = vector<pli>(unique_pair(leftData));
                ++bit;
                if (data.size() == 1) break;
                // groupByBit(bit, data, leftData, rightData);
                continue;
            } else {
                break;
            }
        }
        if (data.size() == 1) {
            value = data.begin()->first;
            maxIdx = data.begin()->second;
            sz = 1;
            nbit = bit;
        }
    }

    long long maxXor(long long n, int idx) {
        if (!left && !right) {
            if (maxIdx > idx) {
                return value ^ n;
            } else {
                return 0;
            }
        } else {
            bool b = nth_bit(n, left->nbit - 1);
            if (b) {
                if (left->maxIdx > idx) {
                    return left->maxXor(n, idx);
                } else {
                    return right->maxXor(n, idx);
                }
            } else {
                if (right->maxIdx > idx) {
                    return right->maxXor(n, idx);
                } else {
                    return left->maxXor(n, idx);
                }
            }
            return 0;
        }

    }

    void print(string prefix = "") {
        cout << prefix << "sz = " << sz << " nbit = " << nbit;
        if (left) {
            cout << '\n';
            left->print(prefix + "    ");
            cout << '\n';
            right->print(prefix + "    ");
        } else {
            cout << "; value = " << value << '\n';
        }
    }
};

template<typename In, typename Out>
void solve(In& in, Out& out)   //WRITE YOUR SOLUTION HERE
{
    int n;
    in >> n;
    long long x;
    vector<pli> a(n), xorsforward(n), xorsbackward(n);
    for (int i = 0; i < n; ++i) {
        in >> x;
        a[i] = make_pair(x, i);
        if (i == 0) {
            xorsforward[i] = make_pair(x, i);
        } else {
            xorsforward[i] = make_pair(xorsforward[i - 1].first ^ x, i);
        }
    }
    for (int i = n - 1; i >= 0; --i) {
        if (i == n - 1) {
            xorsbackward[i] = make_pair(a[i].first, i);
        } else {
            xorsbackward[i] = make_pair(xorsbackward[i + 1].first ^ a[i].first, i);
        }
    }
    long long ans = 0;
    for (auto i: xorsforward) ans = max(ans, i.first);
    for (auto i: xorsbackward) ans = max(ans, i.first);
    BinaryTree tree(xorsbackward, 0);
    for (auto i: xorsforward) ans = max(ans, tree.maxXor(i.first, i.second));
    out << ans;
}

#ifndef ONLINE_JUDGE
const string testdata[codeforces::MAXTESTS] = { "2\n1 2", "3\n1 2 3", "2\n1000 1000", "6\n13 21 3 61 1 2", codeforces::EMPTY };
const string testanswers[codeforces::MAXTESTS] = { "3", "3", "1000", "62", codeforces::EMPTY };
#endif

int main()
{
#ifndef ONLINE_JUDGE
    codeforces::test<solve>(testdata, testanswers);
#else
    solve(cin, cout);
#endif
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <limits>
#include <cctype>

using namespace std;
typedef long long LL;
LL arr[100009];
LL accs[100009],acce[100009];

struct node
{
    int child[2];
    node()
    {
        child[0]=-1;
        child[1]=-1;
    }
};

vector<node> start,send;

LL query( LL a,vector<node> &v )
{

    LL ret=0;

    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if(st==-1)
            return 0;

        if((a & (1ll<<i)))
        {
            f=0;
        }
        else
            f=1;

        if(v[st].child[f]!=-1)
        {
            if(f) ret|=(1ll<<i);
            st=v[st].child[f];
        }
        else
        {
            f=!f;
            if(f) ret|=(1ll<<i);
            st=v[st].child[f];
        }
    }

    return ret;
}

void update(LL &a,vector<node> &v)
{
    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if((a & (1ll<<i)))
        {
            f=1;
        }
        else
            f=0;

       if(v[st].child[f]==-1)
       {
           v[st].child[f]=v.size();
           v.push_back(node());
       }

       st=v[st].child[f];
    }

}
int main()
{
    #ifndef ONLINE_JUDGE
  freopen("2.in","r",stdin);
  #endif
  start.push_back(node());
  send.push_back(node());

  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        accs[i]=accs[i-1]^arr[i];
    }

  for(int i=n;i>0;i--)
    acce[i]=acce[i+1]^arr[i];

  LL ret=0;
  for(int i=1;i<=n;i++)
  {
     LL nw=acce[i];
     ret=max(ret,nw);
     ret=max(ret,query(nw,start)^nw);
     update(accs[i],start);

  }

  for(int i=n;i>0;i--)
  {

     LL nw=accs[i];
     ret=max(ret,nw);
     ret=max(ret,query(nw,send)^nw);
     update(acce[i],send);
  }

  cout<<ret<<endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <limits>
#include <cctype>

using namespace std;
typedef long long LL;
LL arr[100009];

struct node
{
    int child[2];
    node()
    {
        child[0]=-1;
        child[1]=-1;
    }
};

vector<node> trie;

LL query( LL a)
{

    LL ret=0;

    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if(st==-1)
            return 0;

        if((a & (1ll<<i)))
        {
            f=0;
        }
        else
            f=1;

        if(trie[st].child[f]!=-1)
        {
            if(f) ret|=(1ll<<i);
            st=trie[st].child[f];
        }
        else
        {
            f=!f;
            if(f) ret|=(1ll<<i);
            st=trie[st].child[f];
        }
    }

    return ret;
}

void update(LL &a)
{
    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if((a & (1ll<<i)))
        {
            f=1;
        }
        else
            f=0;

       if(trie[st].child[f]==-1)
       {
           trie[st].child[f]=trie.size();
           trie.push_back(node());
       }

       st=trie[st].child[f];
    }

}
int main()
{
    #ifndef ONLINE_JUDGE
  freopen("2.in","r",stdin);
  #endif

  trie.push_back(node());
  int n;
  cin>>n;

  LL prefix,suffix,all;
  prefix=suffix=all=0;

  for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        all^=arr[i];
    }

  LL ret=0;
  suffix=all;
  for(int i=1;i<=n;i++)
  {
     LL nw=suffix;
     ret=max(ret,nw);
     ret=max(ret,query(nw)^nw);
     prefix^=arr[i];
     update(prefix);

  }

  trie.clear();
  trie.push_back(node());
  prefix=all;
  suffix=0;
  for(int i=n;i>0;i--)
  {

     LL nw=prefix;
     ret=max(ret,nw);
     ret=max(ret,query(nw)^nw);
     suffix^=arr[i];
     update(suffix);
  }

  cout<<ret<<endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <limits>
#include <cctype>

using namespace std;
typedef long long LL;
LL arr[100009];

LL accs[100009],acce[100009];

class cmp
{
public:
    bool operator () (const LL &a,const LL &b)const
    {
        return a>b;
    }
};
set<LL , cmp>start[44],send[44];

int get_MSO(LL a)
{
    if(!a)
        return -1;
    for(int i=41;i>=0;i--)
    {
        if(a & (1ll<<i))
            return i;
    }
}
int main()
{
    #ifndef ONLINE_JUDGE
  freopen("2.in","r",stdin);
  #endif

  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        accs[i]=accs[i-1]^arr[i];
    }

  for(int i=n;i>0;i--)
    acce[i]=acce[i+1]^arr[i];

  LL ret=0;
  for(int i=1;i<=n;i++)
  {
      int inde=get_MSO(acce[i]);
      ret=max(ret,acce[i]);
      if(inde!=-1 && start[inde].size())
      {
          ret=max(ret,acce[i]^(*start[inde].begin()));
      }

      for(int j=0;j<41;j++)
      {
          LL t=(1ll<<j);
          if((accs[i]&t)==0) start[j].insert(accs[i]);
      }
  }

    for(int i=n;i>0;i--)
  {
      int inds=get_MSO(accs[i]);
      ret=max(ret,accs[i]);
      if(inds!=-1 && send[inds].size())
      {
          ret=max(ret,accs[i]^(*send[inds].begin()));
      }

      for(int j=0;j<41;j++)
      {
          LL t=(1ll<<j);
          if((acce[i]&t)==0) send[j].insert(acce[i]);
      }
  }

  cout<<ret<<endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <limits>
#include <cctype>

using namespace std;
typedef long long LL;
LL arr[100009];

LL accs[100009],acce[100009];

class cmp
{
public:
    bool operator () (const LL &a,const LL &b)const
    {
        return a>b;
    }
};
set<LL , cmp>start[44],send[44];

int get_MSO(LL a)
{
    if(!a)
        return -1;
    for(int i=41;i>=0;i--)
    {
        if(a & (1ll<<i))
            return i;
    }
}
int main()
{
    #ifndef ONLINE_JUDGE
  freopen("2.in","r",stdin);
  #endif

  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        accs[i]=accs[i-1]^arr[i];
    }

  for(int i=n;i>0;i--)
    acce[i]=acce[i+1]^arr[i];

  LL ret=0;
  for(int i=1;i<=n;i++)
  {
      int inde=get_MSO(acce[i]);
      ret=max(ret,acce[i]);
      if(inde!=-1 && start[inde].size())
      {
          for(auto it:start[inde])
            ret=max(ret,acce[i]^(it));
      }

      for(int j=0;j<41;j++)
      {
          LL t=(1ll<<j);
          if((accs[i]&t)==0) start[j].insert(accs[i]);
      }
  }

    for(int i=n;i>0;i--)
  {
      int inds=get_MSO(accs[i]);
      ret=max(ret,accs[i]);
      if(inds!=-1 && send[inds].size())
      {
           for(auto it:send[inds])
            ret=max(ret,accs[i]^(it));
      }

      for(int j=0;j<41;j++)
      {
          LL t=(1ll<<j);
          if((acce[i]&t)==0) send[j].insert(acce[i]);
      }
  }

  cout<<ret<<endl;

}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <limits>
#include <cctype>

using namespace std;
typedef long long LL;
LL arr[100009];

struct node
{
    int child[2];
    node()
    {
        child[0]=-1;
        child[1]=-1;
    }
};

vector<node> trie;

LL query( LL a)
{

    LL ret=0;

    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if(st==-1)
            return 0;

        if((a & (1ll<<i)))
        {
            f=0;
        }
        else
            f=1;

        if(trie[st].child[f]!=-1)
        {
            if(f) ret|=(1ll<<i);
            st=trie[st].child[f];
        }
        else
        {
            f=!f;
            if(f) ret|=(1ll<<i);
            st=trie[st].child[f];
        }
    }

    return ret;
}

void update(LL &a)
{
    int st=0;
    for(int i=40;i>=0;i--)
    {
        int f;
        if((a & (1ll<<i)))
        {
            f=1;
        }
        else
            f=0;

       if(trie[st].child[f]==-1)
       {
           trie[st].child[f]=trie.size();
           trie.push_back(node());
       }

       st=trie[st].child[f];
    }

}
int main()
{
    #ifndef ONLINE_JUDGE
  freopen("2.in","r",stdin);
  #endif

  trie.push_back(node());
  int n;
  cin>>n;

  LL prefix,suffix,all;
  prefix=suffix=all=0;

  for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
        all^=arr[i];
    }

  LL ret=0;
  suffix=all;
  for(int i=1;i<=n;i++)
  {
     LL nw=suffix;
     ret=max(ret,nw);
     ret=max(ret,query(nw)^nw);
     prefix^=arr[i];
     suffix^=arr[i];
     update(prefix);

  }

  trie.clear();
  trie.push_back(node());
  prefix=all;
  suffix=0;
  for(int i=n;i>0;i--)
  {

     LL nw=prefix;
     ret=max(ret,nw);
     ret=max(ret,query(nw)^nw);
     prefix^=arr[i];
     suffix^=arr[i];
     update(suffix);
  }

  cout<<ret<<endl;

}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        fp=0; while(tc>>=1LL) fp++;
        tc=(*rx.rbegin())/N;
        fpmx=0; while(tc>>=1LL) fpmx++;
        mnc(fp, fpmx);
        optx=((1LL<<fp)-1LL)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
    }
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0); rx.erase(rx0[0]);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-2; id++){
        rx.erase(rx0[id+1]);
        crt=0;
        cur^=a[id];
        tc=*rx.rbegin();
        long long i=0; while(tc>>=1LL) i++;
        for(i--; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
    }
    mxc(mx, cur^a[n-2]);
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a + i);
    for(int i = n - 1; i >= 0; i--) {
        rx0[i] = ((rx0[i + 1] / N)^a[i]) * N + i;
        rx.insert(rx0[i]);
    }
    //rx.insert(0);
    mx = (*rx.rbegin()) / N;
    rx.erase(rx0[0]);
    for(int id = 0; id < n - 2; id++) {
        rx.erase(rx0[id + 1]);
        crt = 0;
        cur ^= a[id];
        tc = *rx.rbegin() / N;
        long long i = 0;
        while(tc >>= 1LL) { i++; }
        for(; i >= 0; i--) {
            crt += (1LL << i) & (~cur);
            it = rx.lower_bound(crt * N);
            if(it == rx.end() || (*it / N) >> i != crt >> i) { crt ^= 1LL << i; }
        }
        mxc(mx, crt ^ cur);
        mxc(mx, cur);
    }
    mxc(mx, cur ^ a[n - 2]);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        optx=((1LL<<62LL)-1)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
        mxc(mx, cur);
    }
    cur^=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        crt=0;
        cur^=a[id];
        for(long long i=62; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
    }
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        optx=((1LL<<62LL)-1)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N-1);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
        mxc(mx, cur);
    }
    cur^=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        fp=0; while(tc>>=1LL) fp++;
        tc=(*rx.rbegin())/N;
        fpmx=0; while(tc>>=1LL) fpmx++;
        mnc(fp, fpmx);
        optx=((1LL<<fp)-1LL)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
        mxc(mx, cur);
    }
    cur^=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    //rx.insert(0);
    mx=(*rx.rbegin())/N;
    rx.erase(rx0[0]);
    for(int id=0; id<n-2; id++){
        rx.erase(rx0[id+1]);
        crt=0;
        cur^=a[id];
        tc=*rx.rbegin();
        long long i=0; while(tc>>=1LL) i++;
        for(i--; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
        mxc(mx, cur);
    }
    mxc(mx, cur^a[n-2]);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0); rx.erase(rx0[0]);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        optx=((1LL<<62LL)-1)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        TOUT("%d %d\n", id, crt);
        mxc(mx, crt^cur);
    }
    cur^=a[n-1];
    //mxc(mx, cur);
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        fp=0; while(tc>>=1LL) fp++;
        tc=(*rx.rbegin())/N;
        fpmx=0; while(tc>>=1LL) fpmx++;
        mnc(fp, fpmx);
        optx=((1LL<<fp)-1LL)^cur;
        crt=0;
        for(int i=39; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
    }
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        optx=((1LL<<62LL)-1)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        TOUT("%d %d\n", id, crt);
        mxc(mx, crt^cur);
    }
    cur^=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    rx.erase(rx0[0]);
    for(int id=0; id<n-2; id++){
        rx.erase(rx0[id+1]);
        crt=0;
        cur^=a[id];
        tc=*rx.rbegin();
        long long i=0; while(tc>>=1LL) i++;
        for(i--; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
    }
    mxc(mx, cur^a[n-2]);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        crt=0;
        cur^=a[id];
        for(long long i=62; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        it=rx.lower_bound(crt*N);
        if(it==rx.end()||((*it/N)&crt)!=crt) crt^=1;
        mxc(mx, crt^cur);
    }
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        fp=0; while(tc>>=1LL) fp++;
        tc=(*rx.rbegin())/N;
        fpmx=0; while(tc>>=1LL) fpmx++;
        mnc(fp, fpmx);
        optx=((1LL<<fp)-1LL)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
    }
    cur^=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], optx, tc, fp, fpmx, b, e, crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        tc=(cur^=a[id]);
        fp=0; while(tc>>=1LL) fp++;
        tc=(*rx.rbegin())/N;
        fpmx=0; while(tc>>=1LL) fpmx++;
        mnc(fp, fpmx);
        optx=((1LL<<fp)-1LL)^cur;
        crt=0;
        for(int i=62; i>=0; i--){
            crt+=(1<<i)&optx;
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1<<i)&optx;
        }
        mxc(mx, crt);
    }
    cur+=a[n-1];
    mxc(mx, cur);
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)  {if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)  {if(mn>(c)) {mn=(c);}}
#define itr         iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    rx.erase(rx0[0]);
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id+1]);
        crt=0;
        cur^=a[id];
        tc=*rx.rbegin();
        long long i=0; while(tc>>=1LL) i++;
        for(i--; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
    }
    printf("%I64d", mx);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt, tc;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        crt=0;
        cur^=a[id];
        tc=*rx.rbegin();
        long long i=0; while(tc>>=1) i++;
        for(i--; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt^=(1LL<<i)&(~cur);
        }
        it=rx.lower_bound(crt*N);
        if(it==rx.end()||((*it/N)&crt)!=crt) crt^=1;
        mxc(mx, crt^cur);
    }
    printf("%I64d", mx);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define IN(a)       scanf("%d", &a)
#define IN2(a, b)   scanf("%d%d", &a, &b)
#define IN3(a,b, c) scanf("%d%d%d", &a, &b, &c)
#define OUT(args...)  {TESTING(printf("OUT:\t\t");) printf(args);}
#define TOUT(args...) {TESTING(printf("TEST:\t");    printf(args);)}
#define ENDL        printf("\n")
#define FOR0(n)     for(unsigned int i=0; i<n; i++)
#define FOR1(n)     for(unsigned int i=1; i<=n; i++)
#define FOR(i,a, b)   for(unsigned int i=a; i<=b; i++)
#define FORV(a)  for(unsigned int i=0; i<(unsigned int)a.size(); i++)
#define mxc(mx, c)	{if(mx<(c)) {mx=(c);}}
#define mnc(mn, c)	{if(mn>(c)) {mn=(c);}}
#define itr			iterator
#define fi          first
#define se          second
#define CLR(a)      memset(a, 0, sizeof a)
#define LINF        4611686018427387904
#define WHITE       0
#define BLACK       1
#define GRAY        2
#define TESTING(ON)
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
enum { INF = 1000000000, N = 100100 };
int n;
set<long long> rx;
set<ll>::itr it;
long long rx0[N], mx, cur, a[N], crt;
int main()
{
    IN(n); FOR0(n) scanf("%I64d", a+i);
    for(int i=n-1; i>=0; i--) {
        rx0[i]=((rx0[i+1]/N)^a[i])*N+i;
        rx.insert(rx0[i]);
    }
    rx.insert(0);
    mx=(*rx.rbegin())/N;
    for(int id=0; id<n-1; id++){
        rx.erase(rx0[id]);
        crt=0;
        cur^=a[id];
        for(long long i=62; i>=0; i--){
            crt+=(1LL<<i)&(~cur);
            it=rx.lower_bound(crt*N);
            if(it==rx.end()||((*it/N)&crt)!=crt) crt-=(1LL<<i)&(~cur);
        }
        mxc(mx, crt^cur);
    }
    printf("%I64d", mx);
	return 0;
}


/*
PROG:   [p]
ID  :   hewifi
LANG:   C++
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
typedef long long ll;
const int N = 100000 + 10;
ll pre[N];
struct Node {
    int val;
    Node *son[2];
    Node() {
        val = 0;
        son[0] = son[1] = NULL;
    }
};
struct Trie {
    Node *root;
    Trie() {
        root = new Node;
    }
    void insert(ll v, int Id) {
        int c;
        Node *u = root;
        for (int i = 40; i >= 0; --i) {
            c = v >> i & 1;
            if (u->son[c] == NULL) {
                u->son[c] = new Node;
            }
            u = u->son[c];
        }
        if (!u->val) u->val = Id;
    }
    ll dfs(ll v, int Id) {
        ll re = 0;
        int c;
        Node *u = root;
        for (int i = 40; i >= 0; --i) {
            c = 1 - (v >> i & 1);
            if (u->son[c] == NULL)
                c = 1 - c;
            if (u->son[c] == NULL) {
                break;
            }
            u = u->son[c];
            if (u->val > 0 && u->val < Id) {
                if ((pre[u->val] ^ v) > re)
                    re = pre[u->val] ^ v;
            }
        }
        return re;
    }
} dic;

ll a[N];
int n;
int main() {
    //freopen("[p].in", "r", stdin);
    //freopen("[p].out", "w", stdout);
    scanf("%d", &n);
    ll ans = 0;
    pre[0] = 0;
    for (int i = 1; i <= n; ++i) {
        scanf("%I64d", &a[i]);
        pre[i] = pre[i - 1] ^ a[i];
        if (pre[i] > ans) ans = pre[i];
        dic.insert(pre[i], i);
    }
    ll v = 0;
    for (int i = n; i >= 1; --i) {
        v = v ^ a[i];
        if (v > ans) ans = v;
        ans = std::max(ans, dic.dfs(v, i));
    }
    printf("%I64d\n", ans);
    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

int n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(ll a, ll b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    pre[0]=0;
    rep(i,n) {
        cin >> arr[i];
        pre[i+1] = pre[i]^arr[i];
    }
    suf[0] = 0;
    rep(i,n) suf[i+1] = suf[i]^arr[n-i-1];

    sort(suf,suf+n);
    int mx = 0;
    repa(k,0,n,1){
        int st=0,en=n-1,y=0;
        repd(i,40,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en+1, (1LL<<i),cmp)-suf;
            if(pos > en) continue;
            if(!bit)
                y=pos,st = pos+1;
            else
                en = pos;
        }
        mx = max(mx, pre[k]^suf[y]);
    }
    cout << mx;

    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

ll n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(ll a, ll b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    pre[0]=0;
    rep(i,n) {
        cin >> arr[i];
        pre[i+1] = pre[i]^arr[i];
    }
    suf[0] = 0;
    rep(i,n) suf[i+1] = suf[i]^arr[n-i-1];

    sort(suf,suf+n+1);
    ll mx = 0;
    repa(k,0,n,1){
        int st=0,en=n;
        repd(i,40,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en+1, (1LL<<i),cmp)-suf;
            if(pos > en) continue;
            if(!bit)
                st = pos;
            else
                en = pos;
        }
        mx = max(mx, pre[k]^suf[st]);
    }
    cout << mx;

    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

int n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(ll a, ll b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    pre[0]=0;
    rep(i,n) {
        cin >> arr[i];
        pre[i+1] = pre[i]^arr[i];
    }
    suf[0] = 0;
    rep(i,n) suf[i+1] = suf[i]^arr[n-i-1];

    sort(suf,suf+n+1);
    int mx = 0;
    repa(k,0,n,1){
        int st=0,en=n,y=0;
        repd(i,40,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en+1, (1LL<<i),cmp)-suf;
            if(pos > en) continue;
            if(!bit)
                y=pos,st = pos;
            else
                en = pos;
        }
        mx = max(mx, pre[k]^suf[y]);
    }
    cout << mx;

    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

int n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(int a, int b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    rep(i,n) {
        cin >> arr[i];
        if(i == 0){
            pre[i]=arr[i];
            suf[n-i-1] = arr[i];
        }
        else{
            pre[i] = pre[i-1]^arr[i];
            suf[n-i-1] = suf[n-i]^arr[i];
        }
    }
    sort(suf,suf+n);
    int mx = 0;
    rep(k,n){
        int most1 = ceil(log2(pre[k])+1e-9)-1;
        int st=0,en=n,y=0;
        repd(i,most1,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en, (1<<i),cmp)-suf;
            if(pos > en) continue;
            if(bit)
                y=pos,st = pos+1;
            else
                en = pos;
        }
        mx = max(mx, pre[k]^suf[y]);
    }
    cout << mx;

    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

ll n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(ll a, ll b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
//    freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    pre[0]=0;
    rep(i,n) {
        cin >> arr[i];
        pre[i+1] = pre[i]^arr[i];
    }
    suf[0] = 0;
    rep(i,n) suf[i+1] = suf[i]^arr[n-i-1];

    sort(suf,suf+n+1);
    ll mx = 0;
    repa(k,0,n,1){
        int st=0,en=n;
        repd(i,40,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en+1, (1LL<<i),cmp)-suf;
            if(pos > en) continue;
            if(!bit)
                st = pos;
            else
                en = pos-1;
        }
        mx = max(mx, pre[k]^suf[st]);
    }
    cout << mx;
    return 0;
}


#include <bits/stdc++.h>

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,a,b,d) for(int i=a; i<=b; i+=d)
#define repd(i,a,b,d) for(int i=a; i>=b; i-=d)
#define repi(it,stl) for(auto it = (stl).begin(); (it)!=stl.end(); ++(it))
#define sz(a) ((int)(a).size())
#define mem(a,n) memset((a), (n), sizeof(a))
#define all(n) (n).begin(),(n).end()
#define mp(a,b) make_pair((a),(b))
#define pii pair<int,int>
#define vi vector<int>
#define vs vector<string>
#define sstr stringstream
#define myfind(v,x) (find(all((v)),(x))-(v).begin())

typedef long long ll;
using namespace std;

int n,arr[100003],pre[100003],suf[100003];
int bitidx;
bool cmp(ll a, ll b){
    return ((a>>bitidx)&1) < ((b>>bitidx)&1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("main.txt","rt",stdin);
    //  freopen("out.txt","wt",stdout);
#endif

    cin >> n;
    pre[0]=0;
    rep(i,n) {
        cin >> arr[i];
        if(i == 0)
            suf[n-i-1] = arr[i];
        else
            suf[n-i-1] = suf[n-i]^arr[i];
        pre[i+1] = pre[i]^arr[i];
    }
    sort(suf,suf+n);
    int mx = 0;
    repa(k,0,n,1){
        int st=0,en=n-1,y=0;
        repd(i,40,0,1){
            int bit = (pre[k]>>i)&1;
            bitidx = i;
            int pos = lower_bound(suf+st, suf+en+1, (1LL<<i),cmp)-suf;
            if(pos > en) continue;
            if(!bit)
                y=pos,st = pos+1;
            else
                en = pos;
        }
        mx = max(mx, pre[k]^suf[y]);
    }
    cout << mx;

    return 0;
}


//be naame khodaa

#include <bits/stdc++.h>

typedef long long ll;

const int maxL = 40;

using namespace std;

ll a[100005], b[100005];
ll go[maxL * 100005][2];
int nodes = 1;

void add(ll val)
{
//	cout << "add " << val << endl;
	int node = 1;
	for (int i = maxL; i >= 0; i--)
	{
		int b = (val >> i)%2;
		if (go[node][b] == 0)
			go[node][b] = ++nodes;
		node = go[node][b];
	}
//	cout << endl;
}

ll getMax(ll val)
{
//	cout << "get " << val << endl;
	int node = 1;
	ll ans = 0;
	for (int i = maxL; i >= 0; i--)
	{
		int b = (val >> i)%2;
		if (go[node][1 - b] != 0)
		{
			ans += (1LL << i);
			node = go[node][1 - b];
		}
		else
			node = go[node][b];
	}
//	cout << ans << endl << endl;
	return ans;
}

int main()
{
	int n;
	cin >> n;
	ll p = 0, s = 0, ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		p ^= a[i];
	}
	for (int i = n; i >= 0; i--)
	{
		add(s);
		ans = max(ans, getMax(p));
		if (i)
		{
			p ^= a[i-1];
			s ^= a[i-1];
		}
	}
	cout << ans << endl;
    return 0;
}


//be naame khodaa

#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <algorithm>

typedef long long ll;

using namespace std;

ll a[100005], b[100005];

struct Node
{
	int s, e, h;
	Node *left, *right;
	Node (int s, int e, int h): s(s), e(e), h(h)
	{
		left = right = NULL;
	}
};

Node *make(int s, int e, int h)
{
	Node *node = new Node(s, e, h);
	int mid = s;
	if ((b[s] >> (h-1))%2 == 0)
	{
		int ts = s, te = e;
		while (te - ts > 1)
		{
			int mid = (ts + te)/2;
			if ((b[mid] >> (h-1))%2 == 0)
				ts = mid;
			else
				te = mid;
		}
		mid = te;
	}
	if (h)
	{
		if (mid > s)
			node -> left = make(s, mid, h-1);
		if (e > mid)
			node -> right = make(mid, e, h-1);
	}
	return node;
}

ll XOR(Node *left, Node *right)
{
	//cout << "Left:" << left->s << ' ' << left->e << endl;
	//cout << "Right:" << right->s << ' ' << right->e << endl;
	ll ans = 0, exp = left->h;
	bool fine = false;
	if (left->left != NULL && right->right != NULL)
	{
		//cout << 1 << endl;
		ans = max(ans, (1 << (exp-1)) + XOR(left->left, right->right));
		fine = true;
	}
	if (left != right && left->right != NULL && right->left != NULL)
	{
		//cout << 2 << endl;
		ans = max(ans, (1 << (exp-1)) + XOR(left->right, right->left));
		fine = true;
	}
	if (!fine && left->left != NULL && right->left != NULL)
	{
		//cout << 3 << endl;
		return XOR(left->left, right->left);
	}
	if (!fine && left->right != NULL && right->right != NULL)
	{
		//cout << 4 << endl;
		return XOR(left->right, right->right);
	}
	return ans;
}

ll solve(int n)
{
	sort(b, b + n);
	int s = 0, e = n;
	Node *root = make(0, n, 10);
	return XOR(root, root);
}

int main()
{
	int n;
	cin >> n;
	ll S = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		S ^= a[i];
	}
	for (int i = 0; i < n; i++)
		a[i] ^= S;
	b[0] = 0;
	for (int i = 1; i <= n; i++)
		b[i] = b[i-1] ^ a[i-1];
	n++;
	cout << solve(n) << endl;
    return 0;
}


//be naame khodaa

#include <bits/stdc++.h>

typedef long long ll;

const int maxL = 40;

using namespace std;

ll a[100005], b[100005];
ll go[maxL * 100005][2];
int nodes = 1;

void add(ll val)
{
	int node = 1;
	for (int i = maxL; i >= 0; i--)
	{
		int b = (val >> i)%2;
		if (go[node][b] == 0)
			go[node][b] = ++nodes;
		node = go[node][b];
	}
}

ll getMax(ll val)
{
	int node = 1;
	ll ans = 0;
	for (int i = maxL; i >= 0; i--)
	{
		int b = (val >> i)%2;
		if (go[node][1 - b] != 0)
		{
			ans += (1LL << i);
			node = go[node][1 - b];
		}
		else
			node = go[node][b];
	}
	return ans;
}

int main()
{
	int n;
	cin >> n;
	ll p = 0, s = 0, ans = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		p ^= a[i];
	}
	for (int i = n-1; i >= 0; i--)
	{
		add(s);
		ans = max(ans, getMax(p));
		p ^= a[i];
		s ^= a[i];
	}
	cout << ans << endl;
    return 0;
}


//be naame khodaa

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

ll a[100005], b[100005];

struct Node
{
	int s, e, h;
	Node *left, *right;
	Node (int s, int e, int h): s(s), e(e), h(h)
	{
		left = right = NULL;
	}
};

Node *make(int s, int e, int h)
{
	Node *node = new Node(s, e, h);
	int mid = s;
	if ((b[s] >> (h-1))%2 == 0)
	{
		int ts = s, te = e;
		while (te - ts > 1)
		{
			int mid = (ts + te)/2;
			if ((b[mid] >> (h-1))%2 == 0)
				ts = mid;
			else
				te = mid;
		}
		mid = te;
	}
	if (h)
	{
		if (mid > s)
			node -> left = make(s, mid, h-1);
		if (e > mid)
			node -> right = make(mid, e, h-1);
	}
	return node;
}

ll XOR(Node *left, Node *right)
{
	ll ans = 0, exp = left->h;
	bool fine = false;
	if (left->left != NULL && right->right != NULL)
	{
		ans = max(ans, (1LL << (exp-1)) + XOR(left->left, right->right));
		fine = true;
	}
	if (left != right && left->right != NULL && right->left != NULL)
	{
		ans = max(ans, (1LL << (exp-1)) + XOR(left->right, right->left));
		fine = true;
	}
	if (!fine && left->left != NULL && right->left != NULL)
		return XOR(left->left, right->left);
	if (!fine && left->right != NULL && right->right != NULL)
		return XOR(left->right, right->right);
	return ans;
}

ll solve(int n)
{
	sort(b, b + n);
	int s = 0, e = n;
	Node *root = make(0, n, 41);
	return XOR(root, root);
}

int main()
{
	int n;
	cin >> n;
	ll S = 0;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	b[0] = (1LL << 40);
	for (int i = 1; i <= n; i++)
		b[i] = b[i-1] ^ a[i-1];
	b[n+1] = 0;
	for (int i = 1; i <= n; i++)
		b[n+1+i] = b[n+i] ^ a[n-i];
	n = 2*n + 2;
	cout << solve(n) - (1LL << 40) << endl;
    return 0;
}


//be naame khodaa

#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

ll a[100005], b[100005];

struct Node
{
	int s, e, h;
	Node *left, *right;
	Node (int s, int e, int h): s(s), e(e), h(h) {}
};

Node *make(int s, int e, int h)
{
	Node *node = new Node(s, e, h);
	int mid = s;
	if ((b[s] >> (h-1))%2 == 0)
	{
		int ts = s, te = e;
		while (te - ts > 1)
		{
			int mid = (ts + te)/2;
			if ((b[mid] >> (h-1))%2 == 0)
				ts = mid;
			else
				te = mid;
		}
		mid = te;
	}
	if (h)
	{
		if (mid > s)
			node -> left = make(s, mid, h-1);
		if (e > mid)
			node -> right = make(mid, e, h-1);
	}
	return node;
}

ll XOR(Node *left, Node *right)
{
//	cout << "Left:" << left->s << ' ' << left->e << endl;
//	cout << "Right:" << right->s << ' ' << right->e << endl;
	ll ans = 0, exp = left->h;
	bool fine = false;
	if (left->left != NULL && right->right != NULL)
	{
//		cout << 1 << endl;
		ans = max(ans, (1 << (exp-1)) + XOR(left->left, right->right));
		fine = true;
	}
	if (left != right && left->right != NULL && right->left != NULL)
	{
//		cout << 2 << endl;
		ans = max(ans, (1 << (exp-1)) + XOR(left->right, right->left));
		fine = true;
	}
	if (!fine && left->left != NULL && right->left != NULL)
	{
//		cout << 3 << endl;
		return XOR(left->left, right->left);
	}
	if (!fine && left->right != NULL && right->right != NULL)
	{
//		cout << 4 << endl;
		return XOR(left->right, right->right);
	}
	return ans;
}

ll solve(int n)
{
	sort(b, b + n);
	int s = 0, e = n;
	Node *root = make(0, n, 10);
	return XOR(root, root);
}

int main()
{
	int n;
	cin >> n;
	ll S = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		S ^= a[i];
	}
	for (int i = 0; i < n; i++)
		a[i] ^= S;
	b[0] = 0;
	for (int i = 1; i <= n; i++)
		b[i] = b[i-1] ^ a[i-1];
	n++;
	cout << solve(n) << endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;

struct node
{
	long long low, high, mid;
	int bit, cnt;
	node *L, *R;

	node() {}
	node(long long _low, long long _high, int _bit)
	{
		low = _low; high = _high;
		mid = (low + high) / 2;
		L = NULL; R = NULL;
		bit = _bit;
		cnt = 0;
	}

	void add(long long val)
	{
		cnt++;
		if (low == high) return;
		if (val >> bit & 1)
		{
			if (R == NULL) R = new node(mid + 1, high, bit - 1);
			R -> add(val);
		}
		else
		{
			if (L == NULL) L = new node(low, mid, bit - 1);
			L -> add(val);
		}
	}

	void remove(long long val)
	{
		cnt--;
		if (low == high) return;
		if (val >> bit & 1)
		{
			R -> remove(val);
			if (R -> cnt == 0) R = NULL;
		}
		else
		{
			L -> remove(val);
			if (L -> cnt == 0) L = NULL;
		}
	}

	long long get(long long val)
	{
		if (low == high) return low;
		if (val >> bit & 1)
		{
			if (L != NULL) return L -> get(val);
			return R -> get(val);
		}
		if (R != NULL) return R -> get(val);
		return L -> get(val);
	}
};

int n;
long long a[100100], xorLeft[100100];

int main()
{
	node root(0LL, (1LL << 40) - 1, 39);
	root.add(0);

	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		xorLeft[i] = xorLeft[i - 1] ^ a[i];
		root.add(xorLeft[i]);
	}

	long long ans = root.get(0), xorRight = 0;
	for (int i = n; i; i--)
	{
		root.remove(xorLeft[i]);
		xorRight ^= a[i];
		ans = max(ans, xorRight ^ root.get(xorRight));
	}

	cout << ans << endl;
}