#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int maxN = 1e5 + 5;
vector<int> a(maxN);
set<int> jed[30];
int main(){
    int br[30]{};
    ios;
    int n;
    cin>>n;
    for(int i = 0;i<n;i++){
        int broj;
        cin>>broj;
        a[i]=broj;
        for(int bit = 0;bit<30;bit++){
            if(broj&(1<<bit)){
                br[bit]++;
            }
        }
    }
    int q;
    cin>>q;
    while(q--){
        int tip;
        cin>>tip;
        if(tip==1){
            int k, x;
            cin>>k>>x;
            k--;
            int nov = x;
            int star = a[k];
            a[k]=x;
            for(int bit = 0;bit<30;bit++){
                int bt = (1<<bit);
                int nv = bt&nov;
                int st = bt&star;
                //cout<<st<<" "<<nv;
                //cout<<endl;
                if(nv>=1&&st==0)br[bit]++;
                if(st>=1&&nv==0)br[bit]--;
            }
        }
        else{
            int k;
            cin>>k;
            k--;
            int res = 0;
            for(int bit = 0;bit<30;bit++){
                //cout<<br[bit]<<" ";
                if(br[bit]>k)res+=(1<<bit);
            }
            //cout<<endl;
            cout<<res<<endl;
        }
    }
}