beecrowd | 1804 | [P2][Univ]
# Mathematicians Needed in Mars

**Timelimit: 1**

By Leandro Zatesko, UFFS Brazil

The *VIII Latin-American Algorithms, Graphs and Optimisation Symposium* (LAGOS 2015), a conference which gathered mathematicians and computer scientists from worldwide to discuss some computational challenges, was held in Beberibe, CE, and happened in the last week. Wanting the participants to relax a bit, the symposium organisers hired buggies to take the researchers to some touristic places in the region. The buggies left the hotel in a queue, one after the other.

Whoever knows the buggy rides of Ceará knows that the tourist can ask the buggy driver a ride *with emotion* or *without emotion*. However, LAGOS excursion faced an extra emotion. Since nowadays in Mars there is a lack of researchers in Graphs, Algorithms and Optimisation, martian aliens started to abduct some buggies, with all people aboard (including the poor driver, who had nothing to do with it). It was very sad for our planet to loose such brilliant minds to Mars, but the tragedy could have been less serious if each buggy driver had been keeping updated the information of how many people in total were in the buggies behind his — this way he would be able to notice the aproximation of the alien probe and to speed the buggy up.

An integer **N** (1 ≤ **N** ≤ 10^{5}) makes the first line of the input, which represents the number of buggies that have left the hotel. The second line of the input consists of **N** integers **p _{i}** (1 ≤

- of a character 'a' followed by an integer
**i**(1 ≤**i**≤**N**), which characterises the abduction of the buggy**i**(which had not been abducted); - of a character ‘?' followed by an integer
**i**(1 ≤**i**≤**N**), which characterises that, in that moment, the buggyman of the non-abducted (yet) buggy**i**would like to know how many people of the excursion remained behind his buggy.

Consider that the identifier **i** of a buggy does not change. Hence, the third buggy to leave the hotel shall always be identified by the integer 3, even though the buggies 1 and 2 happen to be abducted.

For each line "? **i**", print a line containing the number of the people of the excursion still remaining behind the *buggy* **i** in that moment. But do not be a *bugman* (don't put bugs in your code)!

Input Sample | Output Sample |

10 |
24 |