// Problem: E. Boring Segments // Contest: Codeforces - Educational Codeforces Round 112 (Rated for Div. 2) // URL: http://codeforces.com/contest/1555/problem/E // Memory Limit: 256 MB // Time Limit: 3000 ms // // Powered by CP Editor (https://cpeditor.org) #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pairPLL; typedef pairPII; typedef pairPDD; #define I_int ll inline ll read() { ll x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9') { if(ch == '-')f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } inline void out(ll x){ if (x < 0) x = ~x + 1, putchar('-'); if (x > 9) out(x / 10); putchar(x % 10 + '0'); } inline void write(ll x){ if (x < 0) x = ~x + 1, putchar('-'); if (x > 9) write(x / 10); putchar(x % 10 + '0'); } #define read read() #define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define multiCase int T;cin>>T;for(int t=1;t<=T;t++) #define rep(i,a,b) for(int i=(a);i<=(b);i++) #define repp(i,a,b) for(int i=(a);i<(b);i++) #define per(i,a,b) for(int i=(a);i>=(b);i--) #define perr(i,a,b) for(int i=(a);i>(b);i--) ll ksm(ll a, ll b) { ll res = 1; while(b) { if(b & 1)res = res * a ; a = a * a ; b >>= 1; } return res; } const int inf = 0x3f3f3f3f; const int maxn=5e6+7,maxm=210000; ll n,a[maxn],tr[maxn]; ll lowbit(ll x){ return x&-x; } void update(ll pos,ll val){ while(pos<=n){ tr[pos]+=val; pos+=lowbit(pos); } } ll query(ll pos){ ll res=0; while(pos){ res+=tr[pos]; pos-=lowbit(pos); } return res; } bool check(int x){ int t=query(x-1); if(t!=x-1) return 0; return 1; } int main(){ n=read; rep(i,1,n){ int op=read,x=read; if(op==1&&a[x]!=1) a[x]=1,update(x,1); else if(op==2){ //rep(j,1,n){ // cout<