#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, a[maxn], pre[maxn], suf[maxn], maxx, cnt;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	if(fopen("tree.inp", "r"))
	{
		freopen("tree.inp", "r", stdin);
		freopen("tree.out", "w", stdout);
	}
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	pre[1] = 1;
	suf[n] = 1;
	for(int i = 2; i <= n; i++)
	{
		if(a[i] > a[i - 1]) pre[i] = pre[i - 1] + 1;
		else pre[i] = 1;
		maxx = max(maxx, pre[i]);
	}
	for(int i = n - 1; i >= 1; i--)
	{
		if(a[i] < a[i + 1]) suf[i] = suf[i + 1] + 1;
		else suf[i] = 1;
	}
	for(int i = 2; i < n; i++)
	{
		if(a[i - 1] < a[i + 1]) maxx = max(maxx, pre[i - 1] + suf[i + 1]);
	}
	for(int i = 1; i <= n; i++)
	{
		if(pre[i] == maxx && maxx != n) cnt++;
		else if(i >= 2 && i < n && a[i - 1] < a[i + 1] && pre[i - 1] + suf[i + 1] == maxx) cnt++;
	}
	cout << cnt;
	return 0;
}