Statement : Right Maximum
You are given an array
While the array is not empty, an operation is performed:
- The maximum element in the array is chosen (if there are multiple, the rightmost maximum is chosen).
- All elements at or after the chosen element are removed from the array.
Your task is to calculate how many operations are performed before the array becomes empty.
The first line contains one integer
Each test case consists of two lines:
- The first line contains one integer
( ). - The second line contains
integers ( ).
The sum of
For each test case, print one integer — the number of operations performed.
Input
4
5
2 1 2 3 1
6
1 2 3 4 5 6
3
3 2 1
4
1 3 3 1
Output
3
6
1
3
Note
In the first example, array is