Count the record-breakers
A value is a record if it is bigger than every value before it (the first value always counts). Count the records in the array.
Reported in: TCS NQT (Sep 2023) (memory-based)
Input
First line: N. Second line: N integers.
Output
The number of records.
Constraints
1 ≤ N ≤ 10^5.
Example 1
Input:
6
3 4 1 6 2 7
Output:
4Example 2
Input:
4
5 5 4 3
Output:
1Hint: Keep the running maximum and count each time a value beats it.