#include <bits/stdc++.h>
using namespace std;
const long long infll = powl(2, 62) - 1;
const long double pi = 4.0 * atanl(1.0);
const long long mod = powl(10, 9) + 7;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < (long long)(n); ++i) cin >> arr[i];
  unordered_map<long long, pair<long long, long long> > seg;
  for (long long i = 0; i < (long long)(n); ++i) {
    if (seg.count(arr[i]) == 0) seg[arr[i]].first = i;
    seg[arr[i]].second = i;
  }
  vector<long long> table(n, 0);
  for (long long i = 0; i < (long long)(n); ++i) {
    if (seg[arr[i]].first == i) {
      long long last = i;
      set<long long> temp;
      for (long long j = i; j <= last; ++j) {
        if (seg[arr[j]].first < i) break;
        temp.insert(arr[j]);
        last = max(last, seg[arr[j]].second);
        if (j == last) {
          long long xorSum = 0;
          for (long long x : temp) xorSum ^= x;
          if (i - 1 >= 0)
            table[j] = max(table[j], xorSum + table[i - 1]);
          else
            table[j] = max(table[j], xorSum);
          for (long long i = 1; i <= (long long)(n - 1); ++i)
            table[i] = max(table[i], table[i - 1]);
        }
      }
    }
  }
  cout << table[n - 1] << '\n';
  return 0;
}
