#Lutece1163. Intervals Query

Intervals Query

Migrated from Lutece 1163 Intervals Query

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Given an Array AA with length NN (1N51051 \leq N \leq 5 \cdot 10^5), find a longest consecutive sub-interval on Array AA satisfied that there is no more than 1 minimum number and no more than 1 maximum number in the sub-interval.

Input

The first line contains an integer NN (1N51051 \leq N \leq 5 \cdot 10^5) meaning the length of Array AA.

The second line contains NN integers A1,A2,....,AnA_1, A_2 , .... ,A_n (109Ai109-10^9 \leq A_i \leq 10^9).

Output

Output two integers LL and FromFrom representing the length of the longest consecutive sub-interval on Array AA satisfied the condition and the starting position in Array AA (starts from 1).

If there are multiple answers, you can output any of them.

Samples

输入数据 1

1
10

输出数据 1

1 1

输入数据 2

10
8 3 2 5 2 3 4 6 3 6

输出数据 2

6 4

输入数据 3

10
-1 2 -1 2 1 1 2 -1 0 0

输出数据 3

6 5

Resources

2015 UESTC ACM Summer Training Team Selection (4)