#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 1000000;
int a[N], ans = 1;
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i)
        cin >> a[i];

    for (int i = 2, nw = 0; i <= n; ++ i)
    {
        if (a[i] != a[i - 1])
        {
            if (nw == 0) nw = a[i] < a[i - 1]? 1: -1;
            else if ((a[i] < a[i - 1]? 1: -1) * nw == -1) nw = 0, ans ++;
        }
    }
    cout << ans << "\n";
}
