#include <iostream>
#include <vector>

int main()
{
    int N:
    std::cin >> N;

    std::vector<int> H(N+1);
    for (int i = 0; i < N; i++) {
        std::cin >> H[i];
    }
    H[N] = H[N-1];

    int ans = 0;
    for (int i = 1; i < N; i++) {
        if (H[i] < H[0]) continue;
        if (H[i] < H[i-1]) continue;
        if (H[i] > H[i+1]) continue;
        if (H[i] > H[N]) continue;
        ans++;
    }

    std::cout << ans << std::endl;
    
    return 0;
}