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

int N, Q, A[100500], cnt, x, k, b;
int main()
{

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