#C14618. Count Visible Buildings
Count Visible Buildings
Count Visible Buildings
Given a sequence of building heights, determine how many buildings are visible from the left. A building is visible if it is taller than all the buildings to its left. In other words, for a building with height \(h_i\) to be visible, it must satisfy the condition:
\(h_i > \max\{ h_1, h_2, \dots, h_{i-1} \}\)
The first building is always visible. Your task is to compute the number of such visible buildings.
inputFormat
The input is given from standard input (stdin) in the following format:
- An integer \(n\) representing the number of buildings.
- If \(n > 0\), a line with \(n\) space-separated integers representing the heights of the buildings.
outputFormat
Output a single integer to standard output (stdout) representing the count of visible buildings from the left.
## sample0
0