#C11618. Sunset View Buildings
Sunset View Buildings
Sunset View Buildings
You are given a sequence of buildings represented by their heights. A building has an unobstructed view of the sunset if it is taller than all the buildings to its right. In other words, a building can see the sunset if no building to its right is taller.
Input begins with an integer N (0 ≤ N ≤ 105), which is the number of buildings. If N > 0, the next line contains N space-separated integers representing the heights of the buildings. Your task is to compute the number of buildings that can see the sunset.
Note: In the extreme case when N = 0, there are no buildings and the result should be 0.
inputFormat
The first line contains an integer N, the number of buildings. If N > 0, the second line contains N space-separated integers denoting the heights of the buildings from left to right.
outputFormat
Output a single integer, the number of buildings with an unobstructed view of the sunset.
## sample6
3 7 8 3 6 1
3
</p>