#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define INF 1e18
#define maxn 100010
using namespace std;

ll a[maxn];
ll b[33];

void pr(ll i, ll x){
    ll pom1=x; ll pom2=a[i];
    for(ll i=1;i<=32;i++){
        if(pom1%2>pom2%2){
            b[i]++;
        }else if(pom1%2<pom2%2){
            b[i]--;
        }
        pom1/=2;
        pom2/=2;
    }
}

ll res(ll k){
    ll rez=0;
    for(ll i=1;i<=32;i++){
        if(b[i]>=k) rez+=(1LL)<<(i-1);
    }
    return rez;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
    ll n,q; cin>>n;
    for(ll i=1;i<=n;i++){
        ll pommm; cin>>pommm;
        pr(i,pommm); a[i]=pommm;
    }
    cin>>q;
    for(ll i=1;i<=q;i++){
        ll mode; cin>>mode;
        if(mode==0){
            ll k; cin>>k; cout<<res(k)<<"\n";
        }else{
            ll k,x; cin>>k>>x; pr(k,x); a[k]=x;
        }
    }
}