#include <bits/stdc++.h>
using namespace std;
int main() {
  stack<int> aq;
  int n;
  scanf("%d", &n);
  int pr = -1;
  int re = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (pr == -1) {
      pr = x;
      aq.push(x);
      continue;
    }
    re = max(re, pr ^ x);
    while (1) {
      int f = aq.top();
      if (x < f) {
        re = max(re, f ^ x);
        aq.push(x);
        break;
      } else {
        re = max(re, f ^ x);
        aq.pop();
        if (!aq.size()) {
          aq.push(x);
          break;
        }
      }
    }
    pr = x;
  }
  cout << re;
}
