eolymp
bolt
Try our new interface for solving problems
Problems

Larger than neighbors

Larger than neighbors

An array of n integers is given. Find how many its elements are bigger than its two neighbours, and output the number of such elements. The leftmost (first) and rightmost (last) elements do not take into account, because they have one neighbour only.

Input

First line contains number n. Next line contains n integers. All numbers do not exceed 100 by absolute value.

Output

Print the number of elements that are larger than their two neighbours.

Time limit 1 second
Memory limit 128 MiB
Input example #1
7
9 5 -7 -7 5 -9 -4
Output example #1
1