#C11779. Unobstructed Sunset View
Unobstructed Sunset View
Unobstructed Sunset View
You are given a list of building heights. A building has an unobstructed view of the sunset if it is strictly taller than every building to its left. That is, for each building i (0-indexed), it can see the sunset if:
\( H[i] > \max\{H[0], H[1], \dots, H[i-1]\} \)
Note that the first building always has a view since there are no buildings before it.
Your task is to count the number of buildings that have an unobstructed view of the sunset.
inputFormat
The input is given via standard input in the following format:
The first line contains an integer \(n\), the number of buildings. The second line contains \(n\) space-separated integers representing the heights of the buildings.
outputFormat
Output a single integer to standard output, which is the number of buildings with an unobstructed view of the sunset.
## sample5
3 7 8 3 6
3
</p>