#C3279. Clear View Photo Arrangement

    ID: 46688 Type: Default 1000ms 256MiB

Clear View Photo Arrangement

Clear View Photo Arrangement

In a photo shoot, students stand in a line to take a group photo. However, not everyone can get a clear view if someone taller is standing in front. To remedy this, some students may need to sit down. Given the number of students (n) and their heights in the order they are standing, determine the minimum number of students who must sit so that every standing student has an unobstructed view. Specifically, for each student (i) (with (i \ge 2)), if their height (h_i) is less than the maximum height among the students before them, i.e., (\max{h_1, h_2, \ldots, h_{i-1}}), then that student must sit.

inputFormat

The input is given via STDIN and consists of two lines. The first line contains a single integer (n) representing the number of students. The second line contains (n) space-separated integers representing the heights of the students in the order they are standing.

outputFormat

Output a single integer via STDOUT indicating the minimum number of students that must sit to ensure everyone standing has a clear view.## sample

5
150 140 155 160 145
2

</p>