#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ll long long
#define pii pair<int,int>
#define tii tuple <int,int,int>
#define N 200005
#define mod 1000000005
#define X first
#define Y second
#define eps 0.0000000001
#define all(x) x.begin(),x.end()
#define tot(x) x+1,x+n+1
using namespace std;

int n, a[N], sol, cnt1, cnt2, i;

int main() {
    cin.sync_with_stdio(0);
    cout.sync_with_stdio(0);
    cin >> n;

    for(i = 1; i <= n; i++)
        cin >> a[i];

    cnt1 = 1;
    cnt2 = 1;

    for(i = 2; i <= n; i++) {
        if(a[i - 1] < a[i]) {
            if(cnt1 >= 10 && cnt2 >= 10)
                sol++;

            cnt2 = 1;
            cnt1++;
        }

        if(a[i] < a[i - 1]) {
            if(cnt1 >= 10)
                ;
            else {
                cnt1 = 1;
                continue;
            }

            cnt2++;
        }
    }

    if(cnt1 >= 10 && cnt2 >= 10)
        sol++;

    cout << sol;
    return 0;
}