#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
  bool first = true;
  os << "[";
  for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
  bool first = true;
  os << "[";
  for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
struct debugger {
  bool first;
  debugger() { first = true; }
  template <typename T>
  debugger& operator,(const T& v) {
    if (!first) cout << ", ";
    cout << v;
    first = false;
    return *this;
  }
};
long long n;
long long arr[10000000];
long long solve() {
  vector<long long> st;
  long long mx = 0;
  for (long long i = 0; i < n; i++) {
    while (!st.empty() && st.back() < arr[i]) st.pop_back();
    st.push_back(arr[i]);
    if (st.size() >= 2) mx = max(mx, st[st.size() - 1] ^ st[st.size() - 2]);
  }
  return mx;
}
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  long long mx = solve();
  reverse(arr, arr + n);
  cout << max(mx, solve());
}
