#include <bits/stdc++.h>
#define ll long long
using namespace std;

int N, Q, A[100500], cnt, p, k;
bool b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    for(int i = 1; i <= N; i++)
    {
        scanf("%d", &A[i]);
        if(A[i])
            cnt++;
    }
    cin >> Q;
    while(Q--)
    {
        cin >> b;
        if(!b)
        {
            cin >> p;
            if(p > cnt)
                cout << 0 << "\n";
            else
                cout << 1 << "\n";
        }
        else
        {
            cin >> p >> k;
            if(p > cnt and k)
                cnt++;
            else if(p <= cnt and !k)
                cnt--;
        }
    }
    return 0;
}