#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 2;
string s;
long long n;
long long func(vector<long long> a) {
  stack<long long> st;
  long long max_ = 0;
  for (long long i = 0; i < n; i++) {
    while (!st.empty() && a[i] > st.top()) {
      long long cur = st.top();
      st.pop();
      max_ = max(cur ^ a[i], max_);
    }
    st.push(a[i]);
  }
  return max_;
}
void solve() {
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = func(a);
  reverse(a.begin() + 0, a.end());
  ans = max(ans, func(a));
  cout << ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  cout << endl;
  return 0;
}
