For a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique.

* insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.
* find($x$): Report the number of $x$ in $S$ (0 or 1).
* delete($x$): Delete $x$ from $S$.

Constraints

* $1 \leq q \leq 200,000$
* $0 \leq x \leq 1,000,000,000$

Input

The input is given in the following format.


$q$
$query_1$
$query_2$
:
$query_q$


Each query $query_i$ is given by


0 $x$


or


1 $x$


or


2 $x$


where the first digits 0, 1 and 2 represent insert, find and delete operations respectively.

Output

For each insert operation, print the number of elements in $S$.
For each find operation, print the number of specified elements in $S$.

Example

Input

8
0 1
0 2
0 3
2 2
1 1
1 2
1 3
0 2


Output

1
2
3
1
0
1
3
#include <bits/stdc++.h>
using namespace std;

template <typename T>
class avl_tree {
	struct node {
		T val;
		node *ch[2];
		int dep, size;
		node(T v, node* l = nullptr, node* r = nullptr) : val(v), dep(1), size(1) {
			ch[0] = l; ch[1] = r;
		}
	};
	int depth(node *t) { return !t ? 0 : t->dep; }
	int count(node *t) { return !t ? 0 : t->size; }
	node *update(node *t) {
		t->dep = max(depth(t->ch[0]), depth(t->ch[1])) + 1;
		t->size = count(t->ch[0]) + count(t->ch[1]) + 1;
		return t;
	}
	node *rotate(node *t, int b) {
		node *s = t->ch[!b];
		t->ch[!b] = s->ch[b];
		s->ch[b] = t;
		update(t);
		return update(s);
	}
	node *fix(node *t) {
		if (!t) return t;
		int dd = depth(t->ch[0]) - depth(t->ch[1]);
		if (abs(dd) < 2) return t;
		int b = dd < 0;
		if (depth(t->ch[b]->ch[!b]) > depth(t->ch[b]->ch[b])) {
			t->ch[b] = rotate(t->ch[b], b);
		}
		return rotate(t, !b);
	}
	node *insert(node *t, T val) {
		if (!t) return new node(val);
		if (val == t->val) return t;
		int b = val > t->val;
		t->ch[b] = insert(t->ch[b], val);
		return fix(update(t));
	}
	T minimum(node *t) {
		while (t->ch[0]) t = t->ch[0];
		return t->val;
	}
	node *erase(node *t) {
		if (!t) return t;
		if (!t->ch[0] && !t->ch[1]) return nullptr;
		if (!t->ch[0]) return t->ch[1];
		if (!t->ch[1]) return t->ch[0];
		T mini = minimum(t->ch[1]);
		return fix(update(new node(mini, t->ch[0], erase(t->ch[1], mini))));
	}
	node *erase(node *t, T val) {
		if (!t) return t;
		if (val == t->val) return fix(erase(t));
		int b = val > t->val;
		t->ch[b] = erase(t->ch[b], val);
		return fix(update(t));
	}
	node *root;
public:
	avl_tree() : root(nullptr) {}
	int size() {
		return count(root);
	}
	void insert(T val) {
		root = insert(root, val);
	}
	void erase(T val) {
		root = erase(root, val);
	}
	bool count(T val) {
		node *t = root;
		while (t) {
			if (t->val == val) return true;
			t = t->ch[val > t->val];
		}
		return false;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int q;
	cin >> q;
	avl_tree<int> rbt;
	while (q--) {
		int com, x;
		cin >> com >> x;
		if (com == 0) {
			rbt.insert(x);
			printf("%d\n", rbt.size());
		}
		else if (com == 1) {
			puts(rbt.count(x) ? "1" : "0");
		}
		else {
			rbt.erase(x);
		}
	}
	return 0;
}

