#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100009];
int R[100009];
stack<int> s;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  arr[n + 1] = 1e9 + 7;
  n++;
  int ans = 0;
  s.push(n);
  for (int i = n - 1; i >= 1; i--) {
    while (arr[i] >= arr[s.top()]) s.pop();
    R[i] = s.top();
    s.push(i);
  }
  for (int i = 1; i < n; i++) {
    int r = i + 1;
    while (r < n) {
      ans = max(ans, arr[i] ^ arr[r]);
      if (arr[i] <= arr[r]) break;
      r = R[r];
    }
  }
  cout << ans << endl;
  return 0;
}
