#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
const int N = 1e5 + 69;
const int K = 30;
int l[K][N], r[K][N], a[N], n, q;
void addl(int v, int val, int bit) {
    for (int i = v;i < N;i += (i & -i))
        l[bit][i] += val;
}
void addr(int v, int val, int bit) {
    for (int i = v;i < N;i += (i & -i))
        r[bit][i] += val;
}
int getl(int v, int bit) {
    int res = 0;
    for (int i = v;i > 0;i -= (i & -i))
        res += l[bit][i];
    return res;
}
int getr(int v, int bit) {
    int res = 0;
    for (int i = v;i > 0;i -= (i & -i))
        res += r[bit][i];
    return res;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        cin >> n;
        for (int i = 1;i <= n;i++)
            cin >> a[i];
        for (int i = 1;i <= n;i++) {
            for (int j = 0;j < K;j++) {
                if (a[i] >> j & 1)
                    addr(i, 1, j);
                else
                    addl(i, 1, j);
            }
        }
        cin >> q;
        while (q--) {
            int t;
            cin >> t;
            if (t == 1) {
                int d, x;
                cin >> d >> x;
                for (int j = 0;j < K;j++) {
                    if (a[d] >> j & 1) {
                        addr(d, -1, j);
                    }
                    else
                        addl(d, -1, j);
                }
                a[d] = x;
                for (int j = 0;j < K;j++) {
                    if (a[d] >> j & 1) {
                        addr(d, -1, j);
                    }
                    else
                        addl(d, -1, j);
                }
            }
            else {
                int d;
                cin >> d;
                //koliko ima brojeva desno sa 1
                //koliko ima brojeva levo sa 0
                int ans = 0;
                for (int j = K - 1;j >= 0;j--) {
                    if (a[d] >> j & 1) {
                        int desno = getr(N - 1, j) - getr(d, j);
                        int levo =  getl(d - 1, j);

                        if (desno >= levo)
                            ans |= (1 << j);
                    }
                    else {
                        int desno = getr(N - 1, j) - getr(d, j);
                        int levo =  getl(d, j);
                        if (desno >= levo)
                            ans |= (1 << j);
                    }
                }
                cout << ans << '\n';
            }
        }
    }
    return 0;
}