The first line contains a single integer $n$~--- the range of card values ($1 \le n \le 2 \cdot 10^5$).

The second line contains $n$ integers $a_0, a_1, \ldots, a_{n-1}$~--- the number of cards with value $0, 1, \ldots, n-1$ in the deck initially ($0 \le a_i \le 10^6$).

The third line contains a single integer $q$~--- the number of deck modifications ($0 \le q \le 2 \cdot 10^5$).

The $i$-th of the next $q$ lines contains two integers $p_i$ and $v_i$, describing the $i$-th modification ($1 \le p_i \le 2$; $0 \le v_i < n$). If $p_i = 1$, a new card with value $v_i$ is added to the deck. If $p_i = 2$, a card with value $v_i$ is removed from the deck.

It is guaranteed that if $p_i = 2$, then the deck contains at least one card with value $v_i$ right before the $i$-th modification.