#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define pp pop_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define r0 return 0
using namespace std;
const int N = 9 * 1e5 + 5, B = 400;
int n,m,k,l;
int a[N],vis[N];
pair <int,int> p[N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
p[i].ff = a[i];
p[i].ss = i;
}
sort(p + 1, p + 1 + n);
reverse(p + 1, p + 1 + n);
int cur = 0,ans = 0;
for (int i = 1; i <= n; i++) {
if (vis[p[i].ss + 1] == 0 and vis[p[i].ss - 1] == 0) cur++;
else if ((vis[p[i].ss + 1] == 0 and vis[p[i].ss - 1] == 1) or (vis[p[i].ss + 1] == 1 and vis[p[i].ss - 1] == 0)) continue;
else if (vis[p[i].ss + 1] == 1 and vis[p[i].ss - 1] == 1) {
ans = max(ans,cur);
cur--;
}
vis[p[i].ss] = 1;
}
cout << ans << endl;
return 0;
}