//IO
#include <iostream>
#include <cstdio>
#include <fstream>
#include <sstream>
//container
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <string>
//other
#include <algorithm>
#include <math.h>
#include <time.h>
#include <functional>

using namespace std;

// ifstream fin ("data.in");
// ofstream fout ("data.out");

int main(int argc, char *argv[])
{
 int n;
 cin >> n;
 vector<int> a;
 vector<pair<int, int> > sorted_a;
 a.resize(n);
 sorted_a.resize(n);
 for (int i = 0; i < n; ++i)
  {
   cin >> a[i];
   sorted_a[i] = make_pair(a[i], i);
  }
 sort(sorted_a.begin(), sorted_a.end());
 int max_sc = a[0] ^ a[1];
 vector<int> from_right;
 vector<int> from_left;
 from_left.resize(n, -1);
 from_right.resize(n, -1);
 int real_i;
 int startr, startl;
 for (int i = 0; i < n; ++i)
  {
   // take next smallest number position
   real_i = sorted_a[i].second;
   // To find a number it can be xor'ed with, we need to find next
   // number bigger than ours.
   // To find next bigger number from right for this smallest number,
   // we need to go right from the position(or it's from_right
   // position) of latest visitor from the right. This value is stored
   // in from_right.
   // That's because if someone visited us from there, then everybody
   // on it's way is smaller then our number.
   // If noone visited us, just go one point right from current
   // position
   startr = (from_right[real_i]==-1)?real_i+1:from_right[real_i]+1;
   if(startr < n)
    {
     // We go right, so we wisited from left
     // If someone visited us from left, put that number.
     // from_left[real_i] will never change from this point, since we
     // will be smaller than everyone after us.
     from_left[startr] = (from_left[real_i]==-1)?real_i:from_left[real_i];
     if((a[real_i]^a[startr]) > max_sc)
      max_sc = a[real_i]^a[startr];
    }
   // same for other side
   startl = (from_left[real_i]==-1)?real_i-1:from_left[real_i]-1;
   if(startl >= 0)
    {
     from_right[startl] = (from_right[real_i]==-1)?real_i:from_right[real_i];
     if((a[real_i]^a[startl]) > max_sc)
      max_sc = a[real_i]^a[startl];
    }
  }
 cout << max_sc << endl;
 return 0;
}
