#include <stdio.h>
#include <math.h>
#define MAX 100100
const long long xx[30]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608};
long a[MAX][25],sir[MAX],n,kkt[MAX];
long long S=0,inc,sf;
void citire()
{
long x;
freopen ("xormax.in","r",stdin);
scanf("%d",&n);
for (int i=0;i<n;i++)
{
scanf("%d",&sir[i]);
}
fclose(stdin);
}
void max()
{
long max=sir[0];
freopen ("xormax.out","w",stdout) ;
for (int q=0;q<n;q++)
kkt[q]=1;
inc=-1;
sf=-1;
for (int i=1;i<n;i++)
{
if (sir[i]>max)
{
max=sir[i];
inc=i;
sf=inc+kkt[i]-1;
}
if ((sir[i]^sir[i-1])>max)
{
max=sir[i]^sir[i-1];
sir[i]=max;
sf=i;
kkt[i]=kkt[i-1]+1;
inc=sf-kkt[i]+1;
}
}
printf ("%ld %ld %ld \n",max,inc+1,sf+1);
fclose (stdout);
}
int main ()
{
citire();
max();
return 0;
}