Олимпиадный тренинг

Задача 42271. Number of elements greater than both neighbors


You are given an array of integers. Write a program that in the given array determines the number of elements that have two neighboring elements and, at the same time, both neighboring elements are less than the given one.


Input

First given is a number N - number of elements in the array (1 <= N <= 10000). Then, space-separated  N numbers - elements of the array. The array consists of integers.


Output

You need to output the number of array elements that have two neighbors and are strictly greater than both of their neighbors.

 
Examples
# Input Output
1
5
1 2 3 4 5
0
2
5
2 3 2 4 3
2