#include <bits/stdc++.h>
using namespace std;
const int NMax = 100004;
const int INF = (int)(1e18);
const int cntTree = 262145;
const double eps = 1e-9;
const double PI = 3.141592653589793238462;
const int MD = (int)1e9 + 7;
stack<int> c;
int ans = 0, n;
int a[NMax];
int main() {
  scanf("%i", &n);
  for (int i = 1; i <= n; i++) scanf("%i", &a[i]);
  for (int i = 1; i <= n; i++) {
    while (!c.empty() && c.top() < a[i]) {
      ans = ((ans) > ((a[i] ^ c.top())) ? (ans) : ((a[i] ^ c.top())));
      c.pop();
    }
    if (!c.empty())
      ans = ((ans) > ((a[i] ^ c.top())) ? (ans) : ((a[i] ^ c.top())));
    c.push(a[i]);
  }
  cout << ans << endl;
  return 0;
}
