#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, cur, a[100005], n, ans;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (j = 31; j >= 0; j--) {
    cur = 0;
    for (i = 1; i <= n; i++)
      if (a[i] & (1 << j)) cur++;
    if (cur == n || cur == 0) continue;
    l = 1;
    for (i = 1; i <= n; i++)
      if (a[i] & (1 << j)) {
        cur = 0;
        for (k = i - 1; k >= l; k--) {
          cur = (cur > a[k] ? cur : a[k]);
          ans = (ans > (a[i] ^ cur) ? ans : (a[i] ^ cur));
        }
        l = i + 1;
      }
    reverse(a + 1, a + n + 1);
    l = 1;
    for (i = 1; i <= n; i++)
      if (a[i] & (1 << j)) {
        cur = 0;
        for (k = i - 1; k >= l; k--) {
          cur = (cur > a[k] ? cur : a[k]);
          ans = (ans > (a[i] ^ cur) ? ans : (a[i] ^ cur));
        }
        l = i + 1;
      }
    reverse(a + 1, a + n + 1);
    break;
  }
  cout << ans << endl;
}
