#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 6;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int Now = 0, MX = numeric_limits<int>::min();
  int n;
  cin >> n;
  stack<int> stk;
  while (n--) {
    int x;
    cin >> x;
    while (stk.size() && x > stk.top()) MX = max(MX, x ^ stk.top()), stk.pop();
    if (stk.size()) MX = max(MX, x ^ stk.top());
    stk.push(x);
  }
  cout << MX << "\n";
  return 0;
}
