//Dedicated to my love, ivaziva
#include "bits/stdc++.h"
#define dbg(x) cerr << #x << ": " << x << endl;
#define ll long long
#define pb push_back
#define all(a) a.begin(),a.end()
#define si(s) (ll)(s.size())
using namespace std;
#define maxn 100005

int n;
int a[maxn];
int ft1[maxn][30], ft2[maxn][30]; // fenw za prefiks, fenw za sufiks

void upd1(int i, int val, int bit) {
	while(i <= n) {
		ft1[i][bit] += val;
		i += i & (-i);
	}
}

int get1(int i, int bit) {
	int ans = 0;
	while(i > 0) {
		ans += ft1[i][bit];
		i -= i & (-i);
	}
	return ans;
}

signed main(){
	ios_base::sync_with_stdio(false);
	cout.tie(0); cin.tie(0); cerr.tie(0);

    cin >> n;
    for(int i = 0; i < maxn; i++) {
        for(int j = 0; j < 30; j++) {
            ft1[i][j] = 0;
        }
    }
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        for(int j = 0; j < 30; j++) {
            int x = 0;
            if(a[i] & (1 << j)) x = 1;
            upd1(i, x, j);
        }
    }
    int q;
    cin >> q;
    while(q--) {
        int tp;
        cin >> tp;
        if(tp == 0) {
            int idx;
            cin >> idx;
            int p = a[idx];
            for(int i = 0; i < 30; i++) {
                idx--;
                int treba_pref = idx - get1(idx, i);
                idx++;
                int ima_suf = get1(n, i) - get1(idx, i);
                if(p & (1 << i)) { // ako nema upaljen bit nece mu se oduzeti
                    if(treba_pref > ima_suf) p ^= (1 << i);
                } else {
                    if(treba_pref < ima_suf) p ^= (1 << i);
                }
            }
            cout << p << '\n';
        } else {
            int k, x;
            cin >> k >> x;
            int old_val = a[k];
            int nov_idx = n - k + 1;
            for(int i = 0; i < 30; i++) {
                int up1 = (old_val & (1 << i)), up2 = (x & (1 << i));
                if(up1 && up2) {
                    continue;
                } else if(up1 && !up2) {
                    int oduz = -1;
                    upd1(k, oduz, i);
                } else if(!up1 && up2) {
                    upd1(k, 1, i);
                } else {
                    continue;
                }
            }
            a[k] = x;
        }
    }
	return 0;
}