Minimal Shouts
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Once Dmytryk found a device that, when the "Show" button is pressed, displays some positive integer on the screen. Every time he sees a number on the screen that is less than or equal to all previous numbers (or is the first number), he shouts "Wow!".
It is known that Dmytryk pressed the "Show" button \(n\) times. How many times did he shout "Wow!"?
Input
The first line contains a single integer \(n\) — the number of button presses.
The second line contains \(n\) integers in the order they appeared on Dmytryk’s screen.
Output
In a single line, output a single integer — the number of times Dmytryk shouted "Wow!"
Constraints
\(1 \leq n \leq 10^6\),
all numbers that appeared on the screen belong to the range \([1, 10^9]\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 5 58765 345 543 3381 331 | 3 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|