#T29. 合唱队形
合唱队形
Description
students stand in a row, and the music teacher needs to ask of them to step out of the line, leaving the remaining students to form a chorus formation.
A chorus formation is defined as follows: Let the students be numbered from left to right as , with their respective heights being . Their heights must satisfy and for some where .
Your task is, given the heights of all students, to calculate the minimum number of students who need to step out so that the remaining students can form a chorus formation.
Input Format
The first line of input is an integer (), representing the total number of students.
The second line contains integers separated by spaces, where the -th integer () is the height (in centimeters) of the -th student.
Output Format
The output consists of a single line containing one integer, which is the minimum number of students who need to step out.
8
186 186 150 200 160 130 197 220
4
Hint
For 50% of the test cases, it is guaranteed that n ≤ 20; for all test cases, it is guaranteed that n ≤ 100.