#C10411. Sunlit Buildings

    ID: 39614 Type: Default 1000ms 256MiB

Sunlit Buildings

Sunlit Buildings

You are given a row of n buildings with varying heights. A building is considered to receive sunlight if there is no building to its left that is taller or equal in height. Note that the first building always receives sunlight.

Your task is to determine how many of these buildings receive sunlight.

The condition for a building to receive sunlight is that its height is not less than the maximum height encountered among all buildings to its left.

Mathematical Formulation: Let the heights be \(h_1, h_2, \dots, h_n\). A building \(h_i\) receives sunlight if \(h_i \geq \max(\{h_1, h_2, \dots, h_{i-1}\})\) for \(i \ge 2\), and the first building (i = 1) always receives sunlight.

inputFormat

The first line contains an integer n denoting the number of buildings. The second line contains n space-separated integers representing the heights of the buildings.

outputFormat

Output a single integer — the number of buildings that receive sunlight.

## sample
6
7 4 8 2 9 5
3