#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cctype>
#include<vector>
#define maxn 100010
#define gc() getchar()
#define rep(i,s,t) for(int i=(s);i<=(t);i++)
#define isd(x) isdigit(x)
#define pb(x) push_back(x)
using namespace std;
char inc;
inline void get(int& x){
for(x=0,inc=gc();!isd(inc);inc=gc());
for(;isd(inc);x=x*10+inc-'0',inc=gc());
}
int n,m,a[maxn],len,root[maxn],cnt;vector<int>hs;
int getrank(int x){return lower_bound(hs.begin(),hs.end(),x)-hs.begin()+1;}
struct Node{
int ls,rs,sum;
}tr[maxn*40];
void update(int& u,int v,int l,int r,int p)
{
++cnt