#C1551. Sunset Views Count
Sunset Views Count
Sunset Views Count
You are given the heights of n buildings in a row. A building has a clear view of the sunset if every building to its left is strictly shorter than it. Your task is to compute the number of buildings that have a clear view of the sunset.
Formally, given an array \( h = [h_1, h_2, ..., h_n] \), a building \( h_i \) has a clear view if for every building \( h_j \) with \( j < i \), \( h_j < h_i \). You are required to output the count of such buildings.
Example:
Input: 6 3 7 8 3 6 1 Output: 3
inputFormat
The input is given via standard input (stdin) and has two lines:
- The first line contains an 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
Output the number of buildings with a clear view of the sunset to standard output (stdout). The output should be a single integer.
## sample6
3 7 8 3 6 1
3
</p>