#include<cstdio>
#include<set>
#include<algorithm>

using namespace std;

int main(){
    int num_query,command,val;
    scanf("%d",&num_query);
    set<int> int_set;
    set<int>::iterator itr;
    
    for(int i = 0;i < num_query;i++){
        scanf("%d %d",&command,&val);
        if(command == 0){
            int_set.insert(val);
            printf("%d\n",int_set.size());
        }else if(command == 1){
            itr = int_set.find(val);
            if(int_set.end() == itr) printf("0\n");
            else printf("1\n");
        }else if(command == 2){
            itr = int_set.find(val);
            if(int_set.end() != itr) int_set.erase(itr);
        }
    }
    
    return 0;
}
