#t381. 合唱队形(chorus)

合唱队形(chorus)

Chorus Formation

Problem Background

Special for beginners, ^_^

Problem Description

NN students stand in a line. The music teacher wants (N−K)(N-K) of them to step out, leaving KK students forming a chorus formation, while keeping the relative order of all students unchanged.

A chorus formation means: if the KK students from left to right are numbered 1,2,…,K1,2,\dots,K with heights T1,T2,…,TKT_1,T_2,\dots,T_K, 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 NN 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 N (2≤N≤100)N\ (2\le N\le 100) — the total number of students.

The second line contains NN integers separated by spaces; the ii-th integer Ti (130≤Ti≤230)T_i\ (130\le T_i\le 230) is the height (in cm) of the ii-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

2≤N≤1002\le N\le 100; 130≤Ti≤230130\le T_i\le 230.

Time limit 1s, memory limit 1024KiB for each test case.

For 50%50\% of the data, N≤20N\le 20; for all data, N≤100N\le 100.