Japan Alumni Group Summer Camp 2013 Warming Up

F - Maximum Segment XOR


Time limit時間制限 : 1.5sec / Memory limitメモリ制限 : 96MB

Description

XOR is the operation as basic as addition for programmers.
Genius programmer KM made the following problem to test his disciple wata.
Given N integers \{a_i\}, find the two integers s and t (1 \leq s \leq t \leq N) such that a_s\^a_{s+1}\^…\^a_t is maximum possible.
wata couldn't solve this problem, so he asked you, the friend of him and the excellent programmer, to solve this problem for him.

Input

The first line of the input file contains N (1 \leq N \leq 10^5).
The second line contains N integers \{a_i\} (0 \leq a_i < 2^{20}).

Output

Output the maximal value and the pair of (s, t) which gives the maximum.
If there are multiple pairs, output the lexicographically smallest one.

Sample Input

5
1 2 3 4 5

Sample Output

7 3 4

Sample Input

3
3 3 3

Sample Output

3 1 1

Sample Input

4
1 2 4 8

Sample Output

15 1 4

Source name

The First KMCMonthly Contest

Submit提出する