#include <bits/stdc++.h>
const int N = 100007, inf = 0x3f3f3f3f;
using namespace std;
int a[N], lef[N], rig[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  lef[0] = -1;
  for (int i = 1; i < n; ++i) {
    int& p = lef[i];
    for (p = i - 1; p != -1 and a[p] < a[i]; p = lef[p])
      ;
  }
  rig[n - 1] = -1;
  for (int i = n - 2; i >= 0; --i) {
    int& p = rig[i];
    for (p = i + 1; p != -1 and a[p] < a[i]; p = rig[p])
      ;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (lef[i] != -1) ans = max(ans, a[i] ^ a[lef[i]]);
    if (rig[i] != -1) ans = max(ans, a[i] ^ a[rig[i]]);
  }
  cout << ans << endl;
}
