#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define maxn 100050
#define maxlog 31

using namespace std;
typedef long long ll;

ll n, a[maxn][maxlog], x, br1[maxlog], i, s2[maxlog], q, qtype;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    s2[0]=1;
    for(int j=1; j<maxlog; j++){
        s2[j]=s2[j-1]*2;
    }
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x;
        for(int j=0; j<maxlog; j++){
            a[i][j]=x%2;
            x/=2;
            br1[j]+=a[i][j];
        }
    }
    cin >> q;
    while(q--){
        cin >> qtype;
        if(qtype==1){
            cin >> i >> x;
            i--;
            for(int j=0; j<maxlog; j++){
                br1[j]-=a[i][j];
                a[i][j]=x%2;
                x/=2;
                br1[j]+=a[i][j];
            }
        }
        else{
            cin >> i;
            i--;
            ll res=0;
            for(int j=0; j<maxlog; j++){
                if(br1[j]>i) res+=s2[j];
            }
            cout << res << "\n";
        }
    }
}