#include <bits/stdc++.h>
using namespace std;
long long ll, i, j, cl, ss, ce, a[221456], b[212145], c, d;
long long x, m, n, s, t, k, l, y, z;
vector<long long> p, r, q;
map<long long, bool> bb;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (p.size() == 0) {
      p.push_back(x);
      continue;
    }
    j = p.size() - 1;
    while (p[j] < x) {
      s = max(s, x ^ p[j]);
      p.pop_back();
      if (p.size() == 0) {
        break;
      }
      j--;
    }
    if (p.size() == 0) {
      p.push_back(x);
      continue;
    }
    s = max(s, x ^ p[j]);
    p.push_back(x);
  }
  cout << s;
  return 0;
}
