# include <bits/stdc++.h>
using namespace std;

int main() {
    int num_query; scanf("%d", &num_query);
    int command, x;
    set<int> S;
    
    for (int i = 0; i < num_query; ++i) {
        scanf("%d%d", &command, &x);
        int find_result = 0;
        switch (command) {
            case 0:
                S.insert(x);
                printf("%d\n", (int) S.size());
                break;
            case 1:
                if (S.find(x) != S.end()) find_result = 1;
                printf("%d\n", find_result);
                break;
            case 2:
                S.erase(x);
                break;
        }
    }
    return 0;
}
