#include <bits/stdc++.h>

using namespace std;

long long n, a[100003];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    if (n < 19) {
        cout << 0;
        return 0;
    }
    for (long long i = 1; i <= n; ++i)
        cin >> a[i];
    long long cnt = 0;
    int pos1, pos2;
    a[n + 1] = LLONG_MAX;
    a[0] = LLONG_MAX;
    for (int i = 10; i + 9 <= n; ++i) {
        pos1 = i - 1;
        pos2 = i + 1;
        while (a[pos1] < a[pos1 + 1])
            pos1--;
        while (a[pos2] < a[pos2 - 1])
            pos2++;
        if (pos2 >= i + 10 && pos1 <= i - 10)
            ++cnt;
    }
    cout << cnt;
    return 0;
}