#K10741. Magic Extractable Stones

    ID: 23314 Type: Default 1000ms 256MiB

Magic Extractable Stones

Magic Extractable Stones

A wizard has a collection of magical stones arranged in a sequence. Each stone has an associated magical number. The wizard can extract magic from a stone if its magical number is not less than all the stones before it. Formally, given a sequence \(S = [s_1, s_2, \dots, s_n]\), the stone at position \(i\) is extractable if \(s_i \geq \max(s_1, s_2, \dots, s_{i-1})\). Note that the first stone is always extractable.

Your task is to count the number of stones from which magic can be extracted.

inputFormat

The input is read from STDIN and consists of two lines:

  1. The first line contains a single integer \(n\) \((1 \leq n \leq 10^5)\), representing the number of stones.
  2. The second line contains \(n\) space-separated integers, where the \(i\)-th integer represents the magical number on the \(i\)-th stone.

outputFormat

Output to STDOUT a single integer representing the total number of extractable stones.

## sample
5
2 4 1 5 3
3