#include using namespace std; using ll = int64_t; ll mod_pow(ll n,ll p,ll MOD){ ll ans=1LL; while(p){ if(p&1)ans*=n; n*=n; p>>=1; ans%=MOD; n%=MOD; } return ans; } signed main(){ int n; cin>>n; vector a(n,0ll); for(auto& ai:a)cin>>ai; int64_t tmp = 1; const int64_t inf = 1e9; vector kl(n),kr(n); int l=0,r=0; for(;l