#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, g;
  cin >> n;
  int a[n];
  stack<int> Stack;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int maximum = 0;
  for (int i = 0; i < n; i++) {
    while (!Stack.empty()) {
      if (Stack.top() >= a[i]) {
        int n = Stack.top();
        maximum = max(maximum, n ^ a[i]);
        break;
      } else {
        int n = Stack.top();
        Stack.pop();
        maximum = max(maximum, n ^ a[i]);
      }
    }
    Stack.push(a[i]);
  }
  cout << maximum;
}
