#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define MAXN 100010

using namespace std;

/**vector <ll> segm[4*MAXN][31];

void Build(ll cvor, ll L, ll R, ll bit)
{
    if(L == R) {segm[cvor][bit] = (A[L].first & (1 << bit)); return;}
    ll mid = (L + R)/2;
    Build(2*cvor, L, mid, bit);
    Build(2*cvor + 1, mid + 1, R, bit);
    segm[cvor] = segm[2*cvor] + segm[2*cvor + 1];
}

ll Query(ll cvor, ll L, ll R, ll Q_L, ll Q_R, ll bit)
{
    if(L >= Q_L && R <= Q_R) return segm[cvor][bit];
    if(L > Q_R || R < Q_L) return 0;
    ll mid = (L + R)/2;
    return Query(2*cvor, L, mid, Q_L, Q_R, bit) + Query(2*cvor + 1, mid + 1, R, Q_L, Q_R, bit);
}

void Update(ll cvor, ll L, ll R, ll idx, ll val, ll bit)
{
    if(L == R) {segm[cvor][bit] = val; return;}
    ll mid = (L + R)/2;
    if(idx <= mid) Update(2*cvor, L, mid, idx, val, bit);
    else Update(2*cvor + 1, mid + 1, R, idx, val, bit));
    segm[cvor] = segm[2*cvor] + segm[2*cvor + 1];
}
**/
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    ll N, Q, X;
    cin >> N;
    vector <ll> A(N);
    vector <ll> ima(31);
    vector <ll> skibi(31);
    vector <ll> niz(N);
    for(int i = 0; i < N; i++)
    {
        cin >> A[i];
        for(int bit = 0; bit <= 30; bit++)
        {
            if(A[i]&(1LL << bit))
            {
                ima[bit]++;
                niz[skibi[bit]] += (1LL << bit);
                skibi[bit]++;
            }
        }
    }
    for(int bit = 0; bit <= 30; bit++) skibi[bit]--;
    cin >> Q;
    while(Q--)
    {
        ll tip, idx, val;
        cin >> tip;
        if(tip == 0)
        {
            cin >> idx;
            idx--;
            cout << niz[idx] << endl;
        }
        else
        {
            cin >> idx >> val;
            idx--;
            ll vred = A[idx];
            for(int bit = 30; bit >= 0; bit--)
            {
                if(vred&(1LL << bit))
                {
                    niz[skibi[bit]] -= (1LL << bit);
                    skibi[bit]--;
                }
            }
            for(int bit = 0; bit <= 30; bit++) skibi[bit]++;
            A[idx] = val;
            for(int bit = 30; bit >= 0; bit--)
            {
                if(val&(1LL << bit))
                {
                    niz[skibi[bit]] += (1LL << bit);
                    skibi[bit]++;
                }
            }
            for(int bit = 0; bit <= 30; bit++) skibi[bit]--;
        }
    }
    return 0;
}