#include <bits/stdc++.h>
using namespace std;
const int DBG = 0, INF = int(1e9);
string toString(long long k) {
  stringstream ss;
  ss << k;
  string res;
  ss >> res;
  return res;
}
int toInt(string s) {
  stringstream ss;
  ss << s;
  int res;
  ss >> res;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.setf(ios::fixed);
  int n;
  cin >> n;
  vector<int> s(n);
  for (int _n = (n), i = 0; i < _n; ++i) cin >> s[i];
  vector<int> V;
  V.push_back(s[0]);
  int res = 0;
  for (int _b = (n - 1), i = (1); i <= _b; ++i) {
    int a = s[i];
    while (!V.empty() && V.back() < a) {
      res = max(res, V.back() ^ a);
      V.pop_back();
    }
    if (!V.empty()) res = max(res, V.back() ^ a);
    V.push_back(a);
  }
  cout << res << endl;
  return 0;
}
