#C8538. Sunlit Buildings

    ID: 52531 Type: Default 1000ms 256MiB

Sunlit Buildings

Sunlit Buildings

Given a sequence of buildings represented by their heights, a building is considered to receive sunlight if there are no taller buildings to its left. In other words, the i-th building receives sunlight if for every building j with j < i, the height of building j is less than the height of building i. Mathematically, if we denote the height of the i-th building by \(h_i\), then the building receives sunlight if:

[ \forall, j < i,; h_j < h_i ]

Your task is to count the total number of buildings that receive sunlight.

inputFormat

The input is given via stdin and consists of two lines:

  • The first line contains an integer N representing the number of buildings.
  • The second line contains N space-separated integers where each integer represents the height of a building.

outputFormat

Output a single integer to stdout indicating the number of buildings that receive sunlight.

## sample
5
7 4 8 2 9
3