#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main() {
  int n, m;
  scanf("%d", &n);
  long long ans = 0;
  a.resize(1);
  scanf("%d ", &a[0]);
  for (int i = 1; i < n; i++) {
    int b;
    scanf("%d ", &b);
    while (a.size() > 1) {
      if ((a.back() ^ b) > ans) ans = (a.back() ^ b);
      if (b > a.back())
        a.pop_back();
      else
        break;
    }
    a.push_back(b);
  }
  if (ans < (a.back() ^ a[a.size() - 2])) ans = a.back() ^ a[a.size() - 2];
  printf("%I64d", ans);
  return 0;
}
