#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int l[100005], r[100005];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  stack<int> ss;
  for (int i = 0; i < n; i++) {
    while (ss.size() && ss.top() < arr[i]) ss.pop();
    if (ss.size()) l[i] = ss.top();
    ss.push(arr[i]);
  }
  while (ss.size()) ss.pop();
  for (int i = n - 1; i >= 0; i--) {
    while (ss.size() && ss.top() < arr[i]) ss.pop();
    if (ss.size()) r[i] = ss.top();
    ss.push(arr[i]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (l[i]) ans = max(ans, arr[i] ^ l[i]);
    if (r[i]) ans = max(ans, arr[i] ^ r[i]);
  }
  cout << ans << endl;
}
