#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000005 #define Inf64 1000000000000000001LL using P = pair; P op(P a,P b){ return min(a,b); } P e(){ return {Inf32,Inf32}; } P X; bool f(P x){ return x >= X; } int main(){ int n; cin>>n; segtree seg(n); rep(i,n){ int p; cin>>p; seg.set(i,{p,i}); } while(seg.all_prod() != e()){ X = e(); set is; int cx = Inf32,cy = Inf32; while(true){ int r = seg.max_right(0); if(r==n)break; is.insert(r); cx = min(cx,seg.get(r).second+1); cy = min(cy,seg.get(r).first); X = seg.get(r); } cout<