var n,i,j:longint;max:int64;
a:array[1..100000] of int64;
procedure sort(l,r: longint);
var
i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
end;
until i>j;
if l<j then
sort(l,j);
if i<r then
sort(i,r);
end;
begin
assign(input,'xor_equ.in');
reset(input);
assign(output,'xor_equ.out');
rewrite(output);
readln(n);
for i:=1 to n do
read(a[i]);
sort(1,n);
max:=0;
if n<3 then begin max:=a[1]xor a[2];if a[2] xor a[3]>max then max:=a[2]xor a[3];if a[1]xor a[3]>max then max:=a[1]xor a[3];writeln(max);halt; end;
for i:=1 to (n div 4)+2 do
for j:=1 to (n div 4)+2 do
if (a[i] xor a[n-j+1]>max) and (i<>j) then max:=a[i] xor a[n-j+1];
writeln(max);
close(input);
close(output);
end.