#C8346. Buildings With Sunset View

    ID: 52318 Type: Default 1000ms 256MiB

Buildings With Sunset View

Buildings With Sunset View

Given an array of building heights arranged from left to right, determine the number of buildings that can see the sunset. A building can see the sunset if no building to its right is taller than it.

Formally, let the heights be denoted by \(H_1, H_2, \ldots, H_n\). A building \(i\) can see the sunset if for every \(j\) such that \(i < j \leq n\), \(H_j \leq H_i\) holds.

Output the count of such buildings.

inputFormat

The input begins with an integer \(n\) (\(0 \leq n \leq 10^5\)) representing the number of buildings. The next line contains \(n\) space-separated integers representing the heights of the buildings. If \(n = 0\), the second line may be omitted.

outputFormat

Output a single integer representing the number of buildings that can see the sunset.

## sample
7
3 7 8 3 6 1 4
3

</p>