A hero trains with
The power of the
A continuous segment KaTeX can only parse string typed expression is called rising if there exists at least one position KaTeX can only parse string typed expression such that KaTeX can only parse string typed expression and KaTeX can only parse string typed expression.
In simple words, a segment is rising if some stone after the first stone inside that segment has strictly greater power than the first stone.
Your task is to count the number of rising segments.
The first line contains a single integer KaTeX can only parse string typed expression — the number of stones.
The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression — the powers of the stones.
Print a single integer — the number of rising continuous segments.
5
3 1 4 2 5Output8ExplanationFor starting position KaTeX can only parse string typed expression, the first greater stone is at position KaTeX can only parse string typed expression, so endings KaTeX can only parse string typed expression, KaTeX can only parse string typed expression, and KaTeX can only parse string typed expression form rising segments.
For starting position KaTeX can only parse string typed expression, the first greater stone is at position KaTeX can only parse string typed expression, so there are KaTeX can only parse string typed expression rising segments.
For starting position KaTeX can only parse string typed expression, the first greater stone is at position KaTeX can only parse string typed expression, so there is KaTeX can only parse string typed expression rising segment.
For starting position KaTeX can only parse string typed expression, the first greater stone is at position KaTeX can only parse string typed expression, so there is KaTeX can only parse string typed expression rising segment.
Total rising segments are KaTeX can only parse string typed expression.