#include <bits/stdc++.h>
struct node {
  long long int val;
  struct node* next;
};
struct node* push(int value, struct node* head) {
  struct node* temp = (struct node*)malloc(sizeof(struct node));
  temp->val = value;
  temp->next = head;
  return temp;
}
void pri(struct node* head) {
  printf("*");
  while (head) {
    printf("%lld ", head->val);
    head = head->next;
  }
  printf("*");
}
struct node* pop(struct node* head) {
  head = head->next;
  return head;
}
int main() {
  long long int n;
  scanf("%lld *", &n);
  long long int max = 0;
  long long int* ar = (long long int*)malloc(n * sizeof(long long int));
  struct node* head = NULL;
  for (int i = 0; i < n; i++) scanf("%lld", ar + i);
  head = push(ar[0], head);
  for (int i = 1; i - n; i++) {
    if (head && head->val < ar[i]) {
      while (head && head->val < ar[i]) {
        max = (head->val ^ ar[i]) > max ? (head->val ^ ar[i]) : max;
        head = pop(head);
      }
    }
    if (head) max = (head->val ^ ar[i]) > max ? (head->val ^ ar[i]) : max;
    head = push(ar[i], head);
  }
  printf("%lld\n", max);
}
