#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, top;
  long long int s[100005], st[100005], max = -1, c;
  cin >> n;
  for (i = 0; i < n; i++) cin >> s[i];
  st[0] = s[0];
  top = 0;
  for (i = 1; i < n; i++) {
    while (s[i] > st[top] && top >= 0) {
      c = s[i] ^ st[top];
      if (c > max) max = c;
      top--;
    }
    if (top >= 0) c = s[i] ^ st[top];
    if (c > max) max = c;
    top++;
    st[top] = s[i];
  }
  cout << max;
  return 0;
}
