#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
struct SegTree {
  vector<int> dat;
  int size;
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    dat.resize(size * 2, -inf);
  }
  void set(vector<int> &x) {
    for (int i = 0; i < x.size(); ++i) dat[size + i] = x[i];
    for (int i = size - 1; i > 0; --i)
      dat[i] = max(dat[i * 2 + 0], dat[i * 2 + 1]);
  }
  int query(int a, int b, int k, int l, int r) {
    if (a <= l && r <= b) return dat[k];
    if (r <= a || b <= l) return -inf;
    int mid = (l + r) / 2;
    int v1 = query(a, b, k * 2 + 0, l, mid);
    int v2 = query(a, b, k * 2 + 1, mid, r);
    return max(v1, v2);
  }
  int query(int a, int b) { return query(a, b, 1, 0, size); }
};
int main() {
  int n;
  vector<int> x;
  SegTree st;
  scanf("%d", &n);
  x.resize(n);
  for (int i = 0; i < n; ++i) scanf("%d", &x[i]);
  st.init(n);
  st.set(x);
  int ans = 0;
  for (int it = 0; it < n; ++it) {
    int tans = 0;
    if (st.query(it, n) != x[it]) {
      int lb = it + 1, ub = n;
      while (ub - lb > 1) {
        int mid = (ub + lb) / 2;
        if (st.query(it, mid) != x[it])
          ub = mid;
        else
          lb = mid;
      }
      int t = x[it] ^ x[lb];
      tans = max(tans, t);
    }
    if (st.query(0, it + 1) != x[it]) {
      int lb = 0, ub = it;
      while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        if (st.query(mid, it + 1) != x[it])
          lb = mid;
        else
          ub = mid;
      }
      int t = x[it] ^ x[lb];
      tans = max(tans, t);
    }
    ans = max(ans, tans);
  }
  printf("%d\n", ans);
  return 0;
}
