#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN = 100005;
int n;
int arr[MAXN];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
freopen("xormax.in", "r", stdin);
freopen("xormax.out", "w", stdout);
cin >> n;
for (int i =1; i <= n; ++i)
cin >> arr[i];
int maxim = 0, curent = arr[1], start = 1, st = 1, dr = 1;
for (int i = 2; i <= n; ++i) {
if (arr[i] > (curent ^ arr[i])) {
curent = arr[i];
start = i;
}
else curent ^= arr[i];
if (curent > maxim) {
maxim = curent;
st = start;
dr = i;
}
}
cout << maxim << " " << st << " " << dr;
return 0;
}