#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  set<int> s;
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int t,x;
    cin>>t>>x;
    if(t==0) s.emplace(x);
    if(t==0) cout<<s.size()<<endl;
    if(t==1) cout<<s.count(x)<<endl;
    if(t==2) s.erase(x);
  }
  return 0;
}

