#include <bits/stdc++.h>
using namespace std;
struct trie
{
long long int val;
int pos;
struct trie *left;
struct trie *right;
};
struct trie *root;
int maxsize = 32;
struct trie *initialise()
{
struct trie *node;
node = new trie();
node->val = -1;
node->pos = -1;
node->left = NULL;
node->right = NULL;
return node;
};
void insert(long long int n,int m)
{
struct trie *node;
node = root;
int i;
for(i = maxsize - 1; i >= 0; i--) {
if(n&(1 << i)) {
if(node->right == NULL) {
node->right = initialise();
}
node = node->right;
}
else {
if(node->left == NULL) {
node->left = initialise();
}
node = node->left;
}
}
node->val = n;
node->pos = m;
}
pair<long long int,int> query(long long int n)
{
int i;
struct trie *node;
node = root;
for(i = maxsize - 1; i >= 0; i--) {
if(n & (1 << i)) {
if(node->left != NULL) {
node = node->left;
}
else {
node = node->right;
}
}
else {
if(node->right != NULL) {
node = node->right;
}
else {
node = node->left;
}
}
}
return make_pair(node->val,node->pos);
}
int main()
{
long long int n;
long long int a[100005];
int i;
map<long long int,int> m;
int l;
int r;
pair<long long int,int> t;
long long int y;
long long int x;
long long int max;
int count;
root = initialise();
cin>>n;
max = -1;
count = 0;
for(i = 1; i <= n; i++) {
cin>>a[i];
}
insert(0,0);
m[0] = 1;
x = 0;
for(i = 1; i <= n; i++) {
x = x ^ a[i];
if(m[x] == 0) {
insert(x,i);
m[x] = 1;
}
t = query(x);
t.first = t.first ^ x;
if(t.first > max) {
max = t.first;
r = i;
//cout<<t.second<<endl;
l = t.second + 1;
}
}
cout<<max<<endl;
cout<<l<<' '<<r<<endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnN0cnVjdCB0cmllCnsKICAgIGxvbmcgbG9uZyBpbnQgdmFsOwogICAgaW50IHBvczsKICAgIHN0cnVjdCB0cmllICpsZWZ0OwogICAgc3RydWN0IHRyaWUgKnJpZ2h0Owp9OwpzdHJ1Y3QgdHJpZSAqcm9vdDsKaW50IG1heHNpemUgPSAzMjsKc3RydWN0IHRyaWUgKmluaXRpYWxpc2UoKQp7CiAgICBzdHJ1Y3QgdHJpZSAqbm9kZTsKICAgIG5vZGUgPSBuZXcgdHJpZSgpOwogICAgbm9kZS0+dmFsID0gLTE7CiAgICBub2RlLT5wb3MgPSAtMTsKICAgIG5vZGUtPmxlZnQgPSBOVUxMOwogICAgbm9kZS0+cmlnaHQgPSBOVUxMOwogICAgcmV0dXJuIG5vZGU7Cn07CnZvaWQgaW5zZXJ0KGxvbmcgbG9uZyBpbnQgbixpbnQgbSkKewogICAgc3RydWN0IHRyaWUgKm5vZGU7CiAgICBub2RlID0gcm9vdDsKICAgIGludCBpOwoKICAgIGZvcihpID0gbWF4c2l6ZSAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgaWYobiYoMSA8PCBpKSkgewogICAgICAgICAgICBpZihub2RlLT5yaWdodCA9PSBOVUxMKSB7CiAgICAgICAgICAgICAgICBub2RlLT5yaWdodCA9IGluaXRpYWxpc2UoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBub2RlID0gbm9kZS0+cmlnaHQ7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBpZihub2RlLT5sZWZ0ID09IE5VTEwpIHsKICAgICAgICAgICAgICAgIG5vZGUtPmxlZnQgPSBpbml0aWFsaXNlKCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbm9kZSA9IG5vZGUtPmxlZnQ7CiAgICAgICAgfQogICAgfQogICAgbm9kZS0+dmFsID0gbjsKICAgIG5vZGUtPnBvcyA9IG07Cn0KcGFpcjxsb25nIGxvbmcgIGludCxpbnQ+IHF1ZXJ5KGxvbmcgbG9uZyBpbnQgbikKewogICAgaW50IGk7CiAgICBzdHJ1Y3QgdHJpZSAqbm9kZTsKICAgIG5vZGUgPSByb290OwoKICAgIGZvcihpID0gbWF4c2l6ZSAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgaWYobiAmICgxIDw8IGkpKSB7CiAgICAgICAgICAgIGlmKG5vZGUtPmxlZnQgIT0gTlVMTCkgewogICAgICAgICAgICAgICAgbm9kZSA9IG5vZGUtPmxlZnQ7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICBub2RlID0gbm9kZS0+cmlnaHQ7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGlmKG5vZGUtPnJpZ2h0ICE9IE5VTEwpIHsKICAgICAgICAgICAgICAgIG5vZGUgPSBub2RlLT5yaWdodDsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIG5vZGUgPSBub2RlLT5sZWZ0OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIHJldHVybiBtYWtlX3BhaXIobm9kZS0+dmFsLG5vZGUtPnBvcyk7Cn0KCgoKaW50IG1haW4oKQp7CiAgICBsb25nIGxvbmcgaW50IG47CiAgICBsb25nIGxvbmcgaW50IGFbMTAwMDA1XTsKICAgIGludCBpOwogICAgbWFwPGxvbmcgbG9uZyBpbnQsaW50PiBtOwogICAgaW50IGw7CiAgICBpbnQgcjsKICAgIHBhaXI8bG9uZyBsb25nIGludCxpbnQ+IHQ7CiAgICBsb25nIGxvbmcgaW50IHk7CiAgICBsb25nIGxvbmcgaW50IHg7CgogICAgbG9uZyBsb25nIGludCBtYXg7CiAgICBpbnQgY291bnQ7CgoKCiAgICAgcm9vdCA9IGluaXRpYWxpc2UoKTsKICAgIGNpbj4+bjsgCiAgICBtYXggPSAtMTsKICAgIGNvdW50ID0gMDsKICAgIGZvcihpID0gMTsgaSA8PSBuOyBpKyspIHsKICAgICAgICBjaW4+PmFbaV07CgogICAgfQoKCgogICAgaW5zZXJ0KDAsMCk7CiAgICBtWzBdID0gMTsKCiAgICB4ID0gMDsKCiAgICBmb3IoaSA9IDE7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgeCA9IHggXiBhW2ldOwogICAgICAgIGlmKG1beF0gPT0gMCkgewogICAgICAgICBpbnNlcnQoeCxpKTsKICAgICAgICAgbVt4XSA9IDE7CiAgICAgICAgfQogICAgICAgIAogICAgICAgIAogICAgICAgIHQgPSBxdWVyeSh4KTsKICAgICAgICB0LmZpcnN0ID0gdC5maXJzdCBeIHg7CiAgICAgICAgaWYodC5maXJzdCA+IG1heCkgewogICAgICAgICAgICBtYXggPSB0LmZpcnN0OwogICAgICAgICAgICByID0gaTsKICAgICAgICAgICAvL2NvdXQ8PHQuc2Vjb25kPDxlbmRsOwogICAgICAgICAgICAKICAgICAgICAgICAgbCA9IHQuc2Vjb25kICsgMTsKICAgICAgICAgICAgCiAgICAgICAgICAgIAogICAgICAgIH0KICAgIH0KICAgIGNvdXQ8PG1heDw8ZW5kbDsKICAgIGNvdXQ8PGw8PCcgJzw8cjw8ZW5kbDsKCgoKfQo=