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 <utility>
using namespace std;

template<class Key, class T>
struct splay_map {
  struct node {
    node* left;
    node* right;
    node* parent;
    Key key;
    T val;
    node(Key k, T v) : val(v), key(k), left(nullptr), right(nullptr), parent(nullptr){}
    ~node() {
      delete left , left = nullptr;
      delete right , right = nullptr;
    }
  };

  node* root;
  node* fix(node* n) {
    if(!n) return nullptr;
    return n;
  }
  void setl(node* par, node* x) {
    if(par) par->left = x;
    if(x) x->parent = par;
    fix(par);
  }
  void setr(node* par, node* x) {
    if(par) par->right = x;
    if(x) x->parent = par;
    fix(par);
  }
  void zig(node* x) {
    node* p = x->parent;
    setl(p, x->right);
    if(p->parent) {
      if(p->parent->left == p) setl(p->parent, x);
      else setr(p->parent, x);
    }
    else x->parent = nullptr;
    setr(x, p);
  }
  void zag(node* x) {
    node* p = x->parent;
    setr(p, x->left);
    if(p->parent) {
      if(p->parent->left == p) setl(p->parent, x);
      else setr(p->parent, x);
    }
    else x->parent = nullptr;
    setl(x, p);
  }
  void splay(node* x) {
    if(!x) return;
    while(x->parent) {
      if(!x->parent->parent){
        if(x->parent->left == x) zig(x);
        else zag(x);
      }
      else if(x->parent->parent->left == x->parent && x->parent->left == x){
        zig(x->parent);
        zig(x);
      }
      else if(x->parent->parent->left == x->parent && x->parent->right == x){
        zag(x);
        zig(x);
      }
      else if(x->parent->parent->right == x->parent && x->parent->right == x){
        zag(x->parent);
        zag(x);
      }
      else{
        zig(x);
        zag(x);
      }
    }
    root = x;
  }

  bool find(Key key) {
    node* z = root;
    node* p = nullptr;
    while(z) {
      p = z;
      if(z->key == key) {
        splay(z);
        return true;
      }
      else if(z->key < key) {
        z = z->right;
      }
      else {
        z = z->left;
      }
    }
    splay(p);
    return false;
  }
  void insert(Key key, T val) {
    if(find(key)) return;
    node* z = new node(key, val);
    if(root == nullptr)
      root = z;
    else if(root->key < key) {
      setr(z, root->right);
      setr(root,z);
    }
    else {
      setl(z, root->left);
      setl(root, z);
    }
    return splay(z);
  }
  void erase(Key key) {
    if(!find(key)) return;
    node* z = root;
    if(!z->left && !z->right)
      root = nullptr;
    else if(!z->left) {
      root = z->right;
      root->parent = nullptr;
    }
    else if(!z->right) {
      root = z->left;
      root->parent = nullptr;
    }
    else {
      node* lm = z->left;
      while(lm->right) {
        lm = lm->right;
      }
      z->left->parent = nullptr;
      splay(lm);
      root = lm;
      setr(root, z->right);
    }
  }

  splay_map() : root(nullptr) {}
  ~splay_map() { delete root; }
};

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  splay_map<int,int> mp;
  int q;
  cin >> q;
  int ans = 0;
  for(int i = 0;i < q;i++) {
    int c, x;
    cin >> c >> x;
    if(c == 0) {
      if(!mp.find(x)) {
        mp.insert(x,0);
        ans++;
      }
      cout << ans <<endl;
    }
    else if(c == 1) {
      cout << mp.find(x) << endl;
    }
    else {
      if(!mp.find(x)) continue;
      mp.erase(x);
      ans--;
    }
  }
}

