//Dedicated to my love, ivaziva
#include "bits/stdc++.h"
#define dbg(x) cerr << #x << ": " << x << endl;
#define ll long long
#define pb push_back
#define all(a) a.begin(),a.end()
#define si(s) (ll)(s.size())
using namespace std;
#define maxn 100005

int n;
int a[maxn];
int ft1[maxn][30], ft2[maxn][30]; // fenw za prefiks, fenw za sufiks

void upd1(int i, int val, int bit) {
	while(i <= n) {
		ft1[i][bit] += val;
		i += i & (-i);
	}
}

int get1(int i, int bit) {
	int ans = 0;
	while(i > 0) {
		ans += ft1[i][bit];
		i -= i & (-i);
	}
	return ans;
}

void upd2(int i, int val, int bit) {
	while(i <= n) {
		ft2[i][bit] += val;
		i += i & (-i);
	}
}

int get2(int i, int bit) {
	int ans = 0;
	while(i > 0) {
		ans += ft2[i][bit];
		i -= i & (-i);
	}
	return ans;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cout.tie(0); cin.tie(0); cerr.tie(0);

    cin >> n;
    int cnt1 = 0;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        cnt1 += a[i];
    }
    int q;
    cin >> q;
    while(q--) {
        int tp;
        cin >> tp;
        if(tp == 0) {
            int k;
            cin >> k;
            if(cnt1 >= k) {
                cout << 1 << '\n';
            } else cout << 0 << '\n';
        } else {
            int k, x;
            cin >> k >> x;
            cnt1 += (x - a[k]);
            a[k] = x;
        }
    }
	return 0;
}