#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<pair<int,int>>A(n);
for (int i=0; i<n; i++) {
cin >> A[i].first;
A[i].second = i;
}
sort(A.rbegin(),A.rend());
if (n == 1) cout << 1;
else {
vector<bool>used(n,0);
int component = 0;
int ans = 0;
int j = 0;
for (auto &h : A) {
int a = h.first;
while (j < n && A[j].first >= a) {
int i = A[j].second;
bool left = (i-1 >= 0 && used[i-1]);
bool right = (i+1 < n && used[i+1]);
if (left && right) --component;
else if (!left && !right) ++component;
used[i] = 1;
++j;
}
ans = max(ans,component);
}
cout << ans;
}
}