#include <iostream>
using namespace std;

int main()
{   int N,counter_hotel=0,counter_hall=0;
    int h[3000];
    cin >> N;
    for(int i =1;i<=N;i++)
    {
        cin >> h[i];
        if (h[i]>h[i-1] and h[i]>h[i+1])
        {
            counter_hotel++;
        }
        else
        {
            if(h[i]<h[i-1] and h[i]<h[i+1])
            {
                counter_hall++;
            }
        }
    }
    cout << counter_hall << " " << counter_hotel;


    return 0;
}
