#C1339. Count Unobstructed West Views

    ID: 42922 Type: Default 1000ms 256MiB

Count Unobstructed West Views

Count Unobstructed West Views

You are given a sequence of building heights from west to east. A building has an unobstructed view to the west if it is taller than every building before it. Formally, for a sequence of heights \(h_1, h_2, \ldots, h_n\), the i-th building has an unobstructed view if

hi>max{h1,h2,,hi1}h_i > \max\{h_1, h_2, \ldots, h_{i-1}\}

for \(i \ge 1\) (with the convention that the maximum of an empty set is \(-\infty\)). Your task is to compute the total number of buildings that have an unobstructed view.

inputFormat

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 a single integer — the number of buildings that have an unobstructed view to the west.

## sample
6
3 7 8 3 6 1
3