#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000001;
const long long MOD = 1000000007;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  stack<long long> st;
  long long ans = a[0] ^ a[1];
  for (long long i = 0; i < n; i++) {
    while (!(st.empty()) and st.top() < a[i]) {
      ans = max(ans, st.top() ^ a[i]);
      st.pop();
    }
    if (st.size() >= 1) {
      ans = max(ans, (a[i] ^ st.top()));
    }
    st.push(a[i]);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
