#include using namespace std; const int MAXN = 5000005; int father[MAXN]; int a[MAXN]; int num[MAXN]; int get_father(int i) { if (father[i] ==i) return i; return father[i] = get_father(father[i]); } void U(int u, int v){ u = get_father(u); v = get_father(v); if (u==v) return; if (num[u] >n; for(int i=1;i<=n;i++) { father[i]=i; num[i] = 0; a[i]=0; } for(int i=1;i<=n;i++) { scanf("%d %d", &t, &x); if(t==1) { if (a[x]==1) continue; a[x]=1; num[x]=1; if (x-1>=1 && a[x-1]){ //printf("--------------------\n"); U(x-1,x); } if (x+1<=n &&a[x+1]){ //printf("--------------------\n"); U(x,x+1); } } else{ if(a[x]==1){ // printf("?????????\n"); printf("%d\n", num[get_father(1)] + 1); } else{ /*for (int j=1;j<=n;j++) cout<<" "<