All problems

Counting the Green Days

easyPythonTime SeriesLoops

Halcyon's morning note opens with a count of green days: days on which the share closed above the day before. A day that closes exactly level is not green — the desk reports unchanged days separately — so this count is of days that genuinely gained ground.

Task: Print how many days closed higher than the day before them.

Input

The first line holds an integer n, always at least 2. Each of the next n lines holds one day's closing price.

Output

One line: a whole number, somewhere between 0 and n - 1. The opening day has nothing before it and can never be green. Print 0 for a share that never gained.

Example:

Input:
4
3
4
2
5

Output:
2

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…