#include<bits/stdc++.h>
using namespace std;
int n,q;
const int maxn=(int)1e5+10;
unsigned a[maxn];
unsigned mask=1;
int cnt[32];
int k;
unsigned x,c,sol;
vector<unsigned>soll;
void precalc()
{
    for (int i=0; i<=31; i++)
    {
        for (int j=1; j<=n; j++)
            cnt[i]+=(int)((a[j]&mask)!=0);
        mask=mask<<1;
    }
}
void update()
{
    mask=1;
    c=a[k]; //c->x
    a[k]=x;
    for (int i=0; i<=31; i++)
    {
        cnt[i]+=(int)((x&mask)!=0)-(int)((c&mask)!=0);
        mask=mask<<1;
    }
}
void res()
{
    sol=0;
    mask=1;
    for (int i=0; i<=31; i++)
    {
        if (cnt[i]>=k) sol+=mask;
        mask=mask<<1;
    }
    soll.push_back(sol);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    for (int i=1; i<=n; i++)
        cin >> a[i];
    precalc();
    cin >> q;
    int qq;
    while (q--)
    {
        cin >> qq;
        if (qq==0)
        {
            cin >> k;
            res();
            continue;
        }
        else
        {
            cin >> k >> x;
            update();
            continue;
        }
    }
    for (auto it=soll.begin(); it!=soll.end(); it++)
        cout << *it << "\n";
    return 0;
}