#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define N (1000000000+7) //#define N 998244353 #define INF 1e16 typedef long long ll; typedef pair P; typedef pair Q; const int inf = (int)1e9; ll maxl[200010]; ll maxr[200010]; int main(void){ int n; cin>>n; vectora(n); for(int i=0;i>a[i]; maxl[0]=0; for(int i=0;is1,s2; s1.insert(a[0]); for(int i=1;ia[i])&&(a[i]