#include <bits/stdc++.h>
using namespace std;
long long n, arr[100001], satu[100001], maks, ans, oh;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    long long tmp = arr[i];
    long long anu = 0;
    while (tmp > 0) {
      satu[anu] += tmp % 2;
      tmp /= 2;
      anu++;
    }
    maks = max(maks, anu - 1);
  }
  while (satu[maks] == n || satu[maks] == 0) maks--;
  int i = 0;
  int j = i + 1;
  oh = 0;
  while (i < n - 1) {
    if (j == n) break;
    if (!(arr[i] & (1 << maks)))
      i++, j = i + 1, oh = 0;
    else {
      oh = max(oh, arr[j]);
      if (arr[j] >= oh && arr[i] >= oh) ans = max(ans, arr[i] ^ arr[j]);
      if ((arr[j] & (1 << maks)))
        i++, j = i + 1, oh = 0;
      else
        j++;
    }
  }
  i = n;
  j = i - 1;
  oh = 0;
  while (i >= 1) {
    if (j == -1) break;
    if (!(arr[i] & (1 << maks)))
      i--, j = i - 1, oh = 0;
    else {
      oh = max(oh, arr[j]);
      if (arr[j] >= oh && arr[i] >= oh) ans = max(ans, arr[i] ^ arr[j]);
      if ((arr[j] & (1 << maks)))
        i--, j = i - 1, oh = 0;
      else
        j--;
    }
  }
  cout << ans << endl;
}
