#C7498. Count Visible Buildings
Count Visible Buildings
Count Visible Buildings
You are given a row of n buildings with varying heights. When viewed from the left, a building is visible if it is strictly taller than every building to its left. Formally, for a building at index i (0-indexed), it is visible if:
\( h_i > \max\{h_0, h_1, \ldots, h_{i-1}\} \)
If n is 0, then no buildings are present and the answer is 0. Your task is to count the number of buildings visible from the left side.
inputFormat
The input is read from standard input (stdin). The first line contains a non-negative integer n representing the number of buildings. The second line contains n space-separated integers where the i-th integer represents the height of the i-th building.
outputFormat
Print a single integer representing the number of buildings visible from the left side to standard output (stdout).
## sample5
3 1 2 4 5
3