#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 1e5 + 7;
const long long Max = 1e3 + 7;
vector<long long> V;
long long a[Maxn];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  V.push_back(a[1]);
  long long ans = 0;
  for (long long i = 2; i <= n; i++) {
    long long t = V.size() - 1;
    while (V[t] <= a[i] && t > -1) V.pop_back(), t--;
    if (V.size()) ans = max(ans, (V[t] ^ a[i]));
    V.push_back(a[i]);
  }
  V.clear();
  V.push_back(a[n]);
  for (long long i = n - 1; i >= 1; i--) {
    long long t = V.size() - 1;
    while (V[t] <= a[i] && t > -1) V.pop_back(), t--;
    if (V.size()) ans = max(ans, (V[t] ^ a[i]));
    V.push_back(a[i]);
  }
  cout << ans << endl;
  return 0;
}
