#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define fi first
#define si second
#define pii pair<int,int>

using namespace std;

int main()
{
    speed;
    int n;
    cin>>n;
    int niz[n+1],br1=0;
    for(int i=1;i<=n;i++){
        cin>>niz[i];
        br1+=niz[i];
    }
    int q;
    cin>>q;
    while(q--){
        int c;
        cin>>c;
        if(c==1){
            int k,x;
            cin>>k>>x;
            if(niz[k]==0&&x==1){
                br1++;
                niz[k]=1;
            }
            else if(niz[k]==1&&x==0){
                br1--;
                niz[k]=0;
            }
        }
        else{
            int k;
            cin>>k;
            if(br1==0)cout<<0<<endl;
            else cout<<1<<endl;
        }
    }
    return 0;
}