#C4404. Counting Visible Students
Counting Visible Students
Counting Visible Students
You are given the number of students in a line and their heights. The task is to determine how many students are visible from the front. A student is visible if they are taller than every student in front of them. Note that the first student is always visible.
Formally, let there be n students with heights \(h_1, h_2, \dots, h_n\). The answer is the number of indices \(i\) (with \(1 \leq i \leq n\)) such that \(h_i > \max\{h_1, h_2, \dots, h_{i-1}\}\) (with the convention that the maximum of an empty set is \(-\infty\)).
inputFormat
The first line contains an integer \(n\) representing the number of students. The second line contains \(n\) space-separated integers representing the heights of the students in order.
outputFormat
Output a single integer, the number of visible students from the front.
## sample6
1 2 3 2 1 4
4