#C6278. Sunset Views
Sunset Views
Sunset Views
Given a sequence of building heights, your task is to determine the number of buildings that have an unobstructed view of the sunset. The sunset is observed from the left; therefore, a building has a sunset view if it is taller than every building to its left.
More formally, given a list of integers \(a_1, a_2, \dots, a_n\) representing the heights of buildings in order from left to right, a building \(a_i\) has a sunset view if \(a_i > \max\{a_1, a_2, \dots, a_{i-1}\}\). Note that the first building always has an unobstructed view.
Your program should read input from stdin and write the result to stdout.
inputFormat
The first line of input contains a single integer \(n\) (\(1 \leq n \leq 10^5\)) representing the number of buildings. The second line contains \(n\) space-separated positive integers representing the heights of the buildings.
outputFormat
Output a single integer representing the number of buildings that have an unobstructed view of the sunset.
## sample5
4 2 3 1 5
2