E. Intern Florist
time limit per test
2 s
memory limit per test
256 megabytes
input
standard input
output
standard output

In Dinoland, it is a custom to buy your loved one an extravagant gift for Valentine's day!

To honour the tradition, Danny is gathering money to surprise his girlfriend Dannita. However, the gift that he wants to buy is so expensive, that his current savings won't be enough. Luckily, he heard that the local flower shop is recruiting interns to help with the management of the clients' orders.

Whenever a client orders a custom bouquet, Danny needs to create a new file that will contain all the data concerning that bouquet. And whenever a client's bouquet is ready he needs to delete the file containing that bouquet's information. And sometimes his manager will ask him about the number of the bouquets that they still need to prepare.

Danny also recently learned how to use the Command Line, so he will use the following commands to do his tasks as an intern:

  • touch FILENAME: this command is used to create a new file with a certain file name. If a file with the given name already exists, a new file won't be created.
  • rm FILENAME: this command is used to delete a new file with a certain file name. If no file with that name exists, nothing happens.

However, Danny still doesn't know how to count the number of files remaining using Command Line. So he asks for your help.

You will access to the list of commands he typed, and whenever he types the command ask, you need to provide him with the number of available files. Can you help him?

Input

The first line of input contains a single integer $$$N$$$ ($$$1 \leq N \leq 10^6$$$). Each of the next $$$N$$$ lines contains one of the three possible commands (touch, rm or ask). It is guaranteed that there will be at least one command of type ask.

The sum of lengths of the files in the input doesn't exceed $$$2.10^6$$$.

Output

For each command of type ask, you need to output one integer: the number of files currently available.

Example
Input
7
touch love_is_in_the_air
ask
touch Valentine
rm love_is_in_the_air
ask
rm Danny is cool
ask
Output
1
1
1