#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
bool cmp_second(const pair<T, U> &a, const pair<T, U> &b) {
  return a.second < b.second;
}
pair<int, int> operator+(const pair<int, int> &a, const pair<int, int> &b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
pair<int, int> operator-(const pair<int, int> &a, const pair<int, int> &b) {
  return make_pair(a.first - b.first, a.second - b.second);
}
pair<int, int> &operator+=(pair<int, int> &a, const pair<int, int> &b) {
  a.first += b.first;
  a.second += b.second;
  return a;
}
pair<int, int> &operator-=(pair<int, int> &a, const pair<int, int> &b) {
  a.first -= b.first;
  a.second -= b.second;
  return a;
}
inline int sg(int x) { return x ? (x > 0 ? 1 : -1) : 0; }
const int maxp = 30;
int tp[maxp + 1];
int n, s[100050];
int sub() {
  vector<int> stk;
  int sol = 0;
  for (int i = 0; i < n; i++) {
    while (stk.size() && stk.back() < s[i]) {
      sol = max(sol, stk.back() ^ s[i]);
      stk.pop_back();
    }
    stk.push_back(s[i]);
  }
  return sol;
}
int solve() {
  int s1 = sub();
  for (int i = 0; i < n - i - 1; i++) swap(s[i], s[n - i - 1]);
  int s2 = sub();
  return max(s1, s2);
}
int main(void) {
  for (int i = 0; i <= maxp; i++) tp[i] = 1 << i;
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) scanf("%d", &(s[i]));
  printf("%d\n", solve());
  return 0;
}
