#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbs(string str, T t) {
  cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
  long long idx = str.find(',');
  cerr << str.substr(0, idx) << " : " << t << ", ";
  dbs(str.substr(idx + 1), s...);
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class S, class T>
ostream& operator<<(ostream& os, const map<S, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
void prc(T a, T b) {
  cerr << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cerr << ", ";
    cerr << *i;
  }
  cerr << "]\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, k, n, m;
  long long x, y, l, r;
  cin >> n;
  vector<long long> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  stack<long long> q;
  long long ans = v[0] ^ v[1];
  for (i = n - 1; i >= 0; i--) {
    while (!q.empty() && v[q.top()] <= v[i]) {
      x = q.top();
      q.pop();
    }
    if (!q.empty()) ans = max(ans, v[i] ^ v[q.top()]);
    q.push(i);
  }
  while (!q.empty()) {
    x = q.top();
    q.pop();
  }
  for (i = 0; i < n; i++) {
    while (!q.empty() && v[q.top()] <= v[i]) {
      x = q.top();
      q.pop();
    }
    if (!q.empty()) ans = max(ans, v[i] ^ v[q.top()]);
    q.push(i);
  }
  cout << ans << endl;
  return 0;
}
