#C1682. Count Sunlit Buildings
Count Sunlit Buildings
Count Sunlit Buildings
You are given a sequence of building heights. A building is considered to be sunlit if it is taller than every building to its left. In other words, for a building at index i with height \(H_i\), it is sunlit if:
[ H_i > \max{ H_1, H_2, \ldots, H_{i-1} } ]
Your task is to count the number of sunlit buildings.
Example:
Input: 6 7 4 8 2 9 3</p>Output: 3
inputFormat
The first line of input contains an integer n representing the number of buildings. The second line contains n space-separated integers representing the heights of the buildings.
outputFormat
Output a single integer, the number of sunlit buildings.
## sample6
7 4 8 2 9 3
3