#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const long long INF = (long long)1e18 + 7;
int n, ans;
vector<int> a;
void solve() {
  vector<int> st;
  for (int i = 0; i <= n - 1; i++) {
    while (st.size() && st.back() < a[i]) st.pop_back();
    if (st.size()) ans = max(ans, a[i] ^ st.back());
    st.push_back(a[i]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  a.resize(n);
  for (int i = 0; i <= n - 1; i++) cin >> a[i];
  solve();
  reverse(a.begin(), a.end());
  solve();
  cout << ans;
}
