#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int bit[100005], n;
void update(int x, int v) {
  while (x <= n) {
    bit[x] += v;
    x += x & -x;
  }
}
int sum(int x) {
  int ret = 0;
  while (x > 0) {
    ret += bit[x];
    x -= x & -x;
  }
  return ret;
}
int rsq(int l, int r) { return sum(r) - sum(l - 1); }
int arr[100005];
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    arr[i] = x;
    v.push_back(pair<int, int>(x, i));
  }
  sort((v).begin(), (v).end(), greater<pair<int, int> >());
  int xr = 0;
  for (int i = 0; i < v.size(); i++) {
    int lo = v[i].second;
    int hi = n;
    int mid;
    int pos = -1;
    while (lo <= hi) {
      mid = (lo + hi) >> 1;
      if (rsq(v[i].second, mid)) {
        pos = mid;
        hi = mid - 1;
      } else
        lo = mid + 1;
    }
    if (pos != -1) {
      int tmpxor = v[i].first ^ arr[pos];
      xr = max(xr, tmpxor);
    }
    lo = 1;
    hi = v[i].second;
    pos = -1;
    while (lo <= hi) {
      mid = (lo + hi) >> 1;
      if (rsq(mid, v[i].second)) {
        pos = mid;
        lo = mid + 1;
      } else
        hi = mid - 1;
    }
    if (pos != -1) {
      int tmpxor = v[i].first ^ arr[pos];
      xr = max(xr, tmpxor);
    }
    update(v[i].second, 1);
  }
  cout << xr << endl;
  return 0;
}
