#t381. 合唱队形(chorus)
合唱队形(chorus)
Chorus Formation
Problem Background
Special for beginners, ^_^
Problem Description
students stand in a line. The music teacher wants of them to step out, leaving students forming a chorus formation, while keeping the relative order of all students unchanged.
A chorus formation means: if the students from left to right are numbered with heights , then $T_1\lt T_2\lt\dots\lt T_i,\ T_i\gt T_{i+1}\gt\dots\gt T_K\ (1\le i\le K)$.
Given the heights of all students, compute the minimum number of students who must step out so that the remaining students form a chorus formation.
Input Format
The first line is an integer — the total number of students.
The second line contains integers separated by spaces; the -th integer is the height (in cm) of the -th student.
Output Format
Output one line containing a single integer — the minimum number of students who must step out.
Sample Input
8
186 186 150 200 160 130 197 220
Sample Output
4
Constraints
; .
Time limit 1s, memory limit 1024KiB for each test case.
For of the data, ; for all data, .