You are given an array *a*. Some element of this array *a*<sub class="lower-index">*i*</sub> is a local minimum iff it is strictly less than both of its neighbours (that is, *a*<sub class="lower-index">*i*</sub> &lt; *a*<sub class="lower-index">*i* - 1</sub> and *a*<sub class="lower-index">*i*</sub> &lt; *a*<sub class="lower-index">*i* + 1</sub>). Also the element can be called local maximum iff it is strictly greater than its neighbours (that is, *a*<sub class="lower-index">*i*</sub> &gt; *a*<sub class="lower-index">*i* - 1</sub> and *a*<sub class="lower-index">*i*</sub> &gt; *a*<sub class="lower-index">*i* + 1</sub>). Since *a*<sub class="lower-index">1</sub> and *a*<sub class="lower-index">*n*</sub> have only one neighbour each, they are neither local minima nor local maxima.

An element is called a local extremum iff it is either local maximum or local minimum. Your task is to calculate the number of local extrema in the given array.
The first line contains one integer *n* (1 ≤ *n* ≤ 1000) — the number of elements in array *a*.

The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 1000) — the elements of array *a*.
none
3
1 2 3
0
4
1 5 2 5
2
1
1
0
1
548
0
2
1 1
0
3
3 2 3
1
2
1 1000
0
3
1 2 1
1
n = int(input())
a = list(map(int,input().split()))
l = 0
for i in range(1,n-1):
    if a[i]<a[i-1] and a[i]<a[i+1]:
        l = l+1
    if a[i]>a[i-1] and a[i]>a[i+1]:
        l = l+1
print(l)
