#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream fin("FlowerNOIP2013.in");
ofstream fout("FlowerNOIP2013.out");
#define cin fin
#define cout fout
long long n, a = 1, b = 1, la, h;
cin >> n >> la;
for (long long i = 1; i < n; ++i) {
cin >> h;
if (h > la)
a = max(a, b + 1);
if (h < la)
b = max(b, a + 1);
la = h;
}
cout << max(a, b);
}