#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> num(n);
  for (int i = 0; i < n; ++i) cin >> num[i];
  stack<int> S;
  S.push(num[0]);
  int res = 0;
  for (int i = 1; i < n; ++i) {
    while (not S.empty()) {
      res = max(res, num[i] ^ S.top());
      if (num[i] > S.top())
        S.pop();
      else
        break;
    }
    S.push(num[i]);
  }
  cout << res << endl;
}
