#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100005];
int leftBIT[100005], rightBIT[100005];
map<int, int> compress;
int reverse_map[100005];
void updateLeft(int idx, int val) {
  while (idx <= n) {
    leftBIT[idx] = min(leftBIT[idx], val);
    idx += idx & (-idx);
  }
}
void updateRight(int idx, int val) {
  while (idx <= n) {
    rightBIT[idx] = max(rightBIT[idx], val);
    idx += idx & (-idx);
  }
}
int queryLeft(int idx) {
  int ans = n + 1;
  while (idx) {
    ans = min(ans, leftBIT[idx]);
    idx -= idx & (-idx);
  }
  return ans;
}
int queryRight(int idx) {
  int ans = 0;
  while (idx) {
    ans = max(ans, rightBIT[idx]);
    idx -= idx & (-idx);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int i, ans, temp;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
    reverse_map[i] = arr[i];
  }
  sort(reverse_map + 1, reverse_map + n + 1);
  for (i = 1; i <= n; i++) compress[reverse_map[i]] = n + 1 - i;
  for (i = 1; i <= n; i++)
    if (n + 1 - i > i) swap(reverse_map[i], reverse_map[n + 1 - i]);
  for (i = 0; i <= 100000; i++) {
    leftBIT[i] = n + 1;
    rightBIT[i] = 0;
  }
  ans = 0;
  for (i = 1; i <= n; i++) {
    int actual = compress[arr[i]];
    int leftPos = queryRight(actual - 1);
    if (leftPos != 0 && leftPos != i) ans = max(ans, arr[leftPos] ^ arr[i]);
    updateRight(actual, i);
  }
  for (i = n; i >= 1; i--) {
    int actual = compress[arr[i]];
    int rightPos = queryLeft(actual - 1);
    if (rightPos != n + 1 && i != rightPos)
      ans = max(ans, arr[i] ^ arr[rightPos]);
    updateLeft(actual, i);
  }
  cout << ans;
  return 0;
}
