#include <bits/stdc++.h>

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

using namespace std;

uint8_t get_i_bit(ll a, ll place) {
    return ((a & (1 << (place))) >> place);
}

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);
    vector<ll> ones(WDTH);
    loop(i, 0, n)
    {
        cin >> a[i];
        loop(j, 0, WDTH) {
            ones[j] += get_i_bit(a[i], j);
        }
    }

    cin >> q;
    loop(i, 0, q)
    {
        cin >> t >> k;
        k--;
        if (t == 1)
        {
            cin >> x;
            loop(j, 0, WDTH) {
                if (get_i_bit(x, j) != get_i_bit(a[k], j)) {
                    a[k] = x;
                    if (get_i_bit(x, j)) ones[j]++;
                    else ones[j]--;
                }
            }
        }
        else
        {
            ll num = 0;
            loop(j, 0, WDTH) {
                if (k < ones[j]) num += 1 << j;
            }
            cout << num << '\n';
        }
    }

    return 0;
}