#include <bits/stdc++.h>
using namespace std;
map <int,int> harta;
int q,tip,nr,k;
#define DIM 100000
char buff[DIM];
int poz=0;
void citeste(int &numar)
{
numar = 0;
//cat timp caracterul din buffer nu e cifra ignor
while (buff[poz] < '0' || buff[poz] > '9')
//daca am "golit" bufferul atunci il umplu
if (++poz == DIM)
fread(buff,1,DIM,stdin),poz=0;
//cat timp dau de o cifra recalculez numarul
while ('0'<=buff[poz] && buff[poz]<='9')
{
numar = numar*10 + buff[poz] - '0';
if (++poz == DIM)
fread(buff,1,DIM,stdin),poz=0;
}
}
int main () {
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
citeste(q);
for(int i=1;i<=q;++i){
citeste(tip);citeste(nr);
if(tip==1 && harta.find(nr)==harta.end())
harta[nr]=1;
else if (tip==2)
harta.erase(nr);
else if(tip==3){
if(harta.find(nr)!=harta.end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}