#include <bits/stdc++.h>
using namespace std;
const long long int N = 6 * 1e6;
long long int w[N], z[N];
int main() {
  {
    long long int i, j, k, y, n, x, m, a, b, ans = 0, sum = 0, cnt = 0;
    string s, st, taj = "YES";
    cin >> n;
    stack<long long int> stk;
    while (n--) {
      cin >> x;
      while (stk.empty() == false) {
        ans = max(ans, stk.top() ^ x);
        if (stk.top() > x) break;
        stk.pop();
      }
      stk.push(x);
    }
    cout << ans;
  }
  return 0;
}
