#include template inline bool chmax(T& a, T b){ if (a < b){ a = b; return true; } return false; } template inline bool chmin(T& a, T b){ if (a > b){ a = b; return true; } return false; } using namespace std; using ll = long long; ll mod = 1e9+7; int main(){ int n; cin >> n; vector a(n); for(int i=0; i> a[i]; multiset st; int ans = 0; int l = 0; for (int r=0; r