#T29. 合唱队形

合唱队形

Description

NN students stand in a row, and the music teacher needs to ask (NK)(N-K) of them to step out of the line, leaving the remaining KK students to form a chorus formation.

A chorus formation is defined as follows: Let the KK students be numbered from left to right as 1,2,,K1, 2, \dots, K, with their respective heights being T1,T2,,TKT_1, T_2, \dots, T_K. Their heights must satisfy T1<T2<<TiT_1 < T_2 < \dots < T_i and Ti>Ti+1>>TKT_i > T_{i+1} > \dots > T_K for some ii where 1iK1 \leq i \leq K.

Your task is, given the heights of all NN 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 NN (2N1002 \leq N \leq 100), representing the total number of students.
The second line contains NN integers separated by spaces, where the ii-th integer TiT_i (130Ti230130 \leq T_i \leq 230) is the height (in centimeters) of the ii-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.