#C2004. Count Visible People
Count Visible People
Count Visible People
You are given a sequence of n people standing in a line, each with a certain height. When you look from left to right, a person is visible if and only if their height is strictly greater than every person to their left.
Your task is to count the number of visible people from left to right.
Formally, if the heights are given as an array \(h_1, h_2, \dots, h_n\), then a person at position \(i\) is visible if \(h_i > \max\{h_1, h_2, \dots, h_{i-1}\}\) (with the convention that the maximum over an empty set is \(-\infty\)).
inputFormat
The input is given from standard input (stdin). The first line contains an integer \(n\) (\(0 \le n \le 10^5\)) representing the number of people. The second line contains \(n\) space-separated integers representing the heights of the people.
outputFormat
Output a single integer to standard output (stdout), representing the number of visible people when scanning from left to right.
## sample1
100
1