// Created by Nikolay Budin

#ifdef DEBUG
#  define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include "testlib.h"
#define ff first
#define ss second
#define szof(x) ((int)x.size())
#ifndef LOCAL
#  define cerr __get_ce
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef unsigned long long ull;

using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename K, typename V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;

int const INF = (int)1e9 + 1e3;
ll const INFL = (ll)1e18 + 1e6;

const int MAX_N = 200'000;
const int MAX_A = 1'000'000;
const int MAX_Q = 200'000;

int main(int argc, char* argv[]) {
	registerValidation(argc, argv);

	int n = inf.readInt(1, MAX_N, "n");
	inf.readEoln();
	vector<int> a(n);
	for (int i = 0; i < n; ++i) {
		a[i] = inf.readInt(0, MAX_A, format("a_%d", i));
		if (i < n - 1) {
			inf.readSpace();
		} else {
			inf.readEoln();
		}
	}	

	int q = inf.readInt(0, MAX_Q, "q");
	inf.readEoln();

	for (int i = 0; i < q; ++i) {
		int p = inf.readInt(1, 2, format("p_%d", i + 1));
		inf.readSpace();
		int v = inf.readInt(0, n - 1, format("v_%d", i + 1));
		inf.readEoln();
		if (p == 1) {
			a[v] += 1;
		} else {
			ensuref(a[v] > 0, "a[%d] = 0 before modification %d", v, i + 1);
			a[v] -= 1;
		}
	}

	inf.readEof();

	return 0;
}
