#include <bits/stdc++.h>
using namespace std;
vector<int> vc;
int a[100010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int maxn = -1;
  for (int i = 1; i <= n; i++) {
    while (!vc.empty()) {
      maxn = max(vc.at(vc.size() - 1) ^ a[i], maxn);
      if (vc.at(vc.size() - 1) > a[i]) {
        break;
      }
      vc.erase(vc.end() - 1);
    }
    vc.push_back(a[i]);
  }
  cout << maxn;
}
