#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int solve() {
  int ans = 0, b[100001], j = 0;
  b[j++] = 1 << 28;
  for (int i = 0; i < n; i++) {
    while (a[i] > b[j - 1]) j--;
    if (j != 1) ans = max(ans, a[i] ^ b[j - 1]);
    b[j++] = a[i];
  }
  return ans;
}
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = solve();
  reverse((a).begin(), (a).end());
  cout << max(ans, solve()) << endl;
  return 0;
}
