#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define int long long
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

signed main() {
	int N;
	int a[100005];
	cin >> N;
	REP(i, N) {
		cin >> a[i];
	}

	int ans = 1;
	int inc = 1;
	for (int i = 1;i < N;i++) {
		if (a[i] > a[i - 1]) {
			inc++;
		}
		else if (a[i] < a[i - 1]) {
			inc = 1;
		}

		//cout << inc << endl;

		ans = max(ans, inc);
	}

	int dec = 1;
	for (int i = 1;i < N;i++) {
		if (a[i] < a[i - 1]) {
			dec++;
		}
		else if (a[i] > a[i - 1]) {
			dec = 1;
		}

		//cout << dec << endl;

		ans = max(ans, dec);
	}


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