Count Elements Greater Than PreviousEasy

Count Elements Greater Than Previous

EasyPractice library · +10 XPgreedyarraysloops

Given a list of N integers, count how many elements are strictly greater than the element that comes immediately before them in the list. The first element has no preceding element, so it is never counted.

Input

The first line contains an integer N. The second line contains N space-separated integers: a_1, a_2, ..., a_N.

Output

Print a single integer: the count of elements a_i such that a_i > a_{i-1} for i from 2 to N.

Constraints

1 <= N <= 1000. Each integer a_i will be between -10^9 and 10^9.

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
5
1 3 2 4 5
Output
3

3 > 1, 4 > 2, 5 > 4. Count is 3.

Example 2

Input
4
5 4 3 2
Output
0

No element is greater than its previous. Count is 0.

Hints