You are given an array of
- Choose a subarray
with where the size is odd and are all distinct. Replace all of with their median.
Determine
- The minimum number of distinct numbers in
after performing a finite number of operations. - The maximum number of operations performed among all sequences of operations that achieve the minimum in (1). It can be proven that this answer is finite.
- The number of sequences of operations that achieve both the minimum in (1) and the maximum in (2), modulo
.
Constraints
All
Subtask 1 [40%]
Subtask 2 [30%]
Subtask 3 [30%]
No additional constraints.
Input Specification
The first line contains the integer
The second line contains
Output Specification
Output
Sample Input
Copy
6
3 1 4 2 5 6
Sample Output
Copy
2 2 3
Explanation
The
: The array becomes . : The array becomes . : The array becomes .
Comments