#include <bits/stdc++.h>
using namespace std;
class Stack {
  int top;

 public:
  long long a[100000];
  Stack() { top = -1; }
  void push(long long x);
  long long pop();
  long long peek();
  bool isEmpty() { return (top == -1); }
  bool isFull() { return (top == (100000 - 1)); }
};
void Stack::push(long long x) {
  if (isFull()) return;
  a[++top] = x;
}
long long Stack::pop() {
  if (isEmpty()) return -1;
  return a[top--];
}
long long Stack::peek() { return a[top]; }
long long Xor(long long x, long long y) { return (x ^ y); }
int main() {
  int n;
  cin >> n;
  long long* arr = new long long[n];
  for (int i = 0; i < n; ++i) cin >> arr[i];
  Stack stck;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    while (!stck.isEmpty()) {
      if (stck.peek() < arr[i]) {
        ans = max(ans, Xor(stck.pop(), arr[i]));
      } else {
        ans = max(ans, Xor(stck.peek(), arr[i]));
        break;
      }
    }
    stck.push(arr[i]);
  }
  cout << ans << endl;
}
