You have an array A of N integers A1,A2...AN.
startP and endP are 2 integers defined in array partition P, which
consists all the elements lying at positions [startP,startP+1...endP].
That is, partition P refers to subarray [AstartP,AstartP+1...AendP]
such that startP≤endP.
The value of partition is defined as maximum element present in the partition i.e. value(P)=maximum(AstartP,AstartP+1...AendP).
You have to find the total number of ways to divide array A into
sequence of partitions such that each element of A belongs to exactly one partition and value of each partition is not less than the value of next partition.
Formally, Suppose you divided array A into k partitions P1,P2...Pk for
some k≥1, then following conditions should be met:
You have to find out total number of ways to divide array A into such sequence of partitions.
INPUT:
Output:
Constraints:
1≤T≤20
1≤N≤105
1≤Ai≤105
Explanation
In first sample case, all the 4 possible partitions are [[3,2,1]], [[3], [2,1]], [[3,2], [1]], [[3], [2], [1]].
In second sample case, only 2 partitions are possible [[1,3,2]] and [[1,3], [2]].