#include <bits/stdc++.h>
using namespace std;
long long a[100010];
long long s[100010];
long long l[100010];
long long r[100010];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long top = 0;
  s[0] = 0;
  for (long long i = 1; i <= n; i++) {
    while (top && a[s[top]] < a[i]) top--;
    l[i] = s[top];
    s[++top] = i;
  }
  top = 0;
  s[0] = n + 1;
  for (long long i = n; i >= 1; i--) {
    while (top && a[s[top]] < a[i]) top--;
    r[i] = s[top];
    s[++top] = i;
  }
  long long res = 0;
  for (long long i = 1; i <= n; i++) {
    if (l[i]) res = max(res, a[i] ^ a[l[i]]);
    if (r[i] != n + 1) res = max(res, a[i] ^ a[r[i]]);
  }
  cout << res << endl;
  return 0;
}
