#include <bits/stdc++.h>

#define ll long long
#define loop(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll n, q, t, k, x;
    cin >> n;
    vector<ll> a(n);
    ll o = 0;
    loop(i, 0, n)
    {
        cin >> a[i];
        if (a[i]) o++;
    }
    cin >> q;
    loop(i, 0, q)
    {
        cin >> t >> k;
        k--;
        if (t == 1)
        {
            cin >> x;
            if (a[k] != x) {
                if (x == 1) o++;
                else o--;
            }
        } else {
            if (k < o) cout << "1\n";
            else cout << "0\n";
        }

    }

    return 0;
}