#include <bits/stdc++.h>

#define maxn 100001

typedef long long ll;

using namespace std;

int n;
int arr[maxn];
int bitovi[18];

void promeni(int k) {
	int x, j;
	cin >> x;
	int a = arr[k - 1], b = x;
	j = 0;
	while(a > 0) {
		bitovi[j] -= (a & 1);
		a = a >> 1;
		j++;
	}
	j = 0;
	while(b > 0) {
		bitovi[j] += (b & 1);
		b = b >> 1;
		j++;
	}
	arr[k - 1] = x;
}

void rekonstrukcija(int k) {
	int c = 1, br = 0;
	for(int i = 0; i < 18; i++) {
		if(bitovi[i] >= k) {
			br += c;
		}
		c = c << 1;
	}
	cout << br << "\n";
}

void prep() {
	memset(bitovi, 0, sizeof(bitovi));
	for(int i = 0; i < n; i++) {
		int j = 0, cur = arr[i];
		while(cur > 0) {
			bitovi[j] += (cur & 1);
			cur = cur >> 1;
			j++;
		}
	}
}

void solve() {
	int t, k;
	cin >> t >> k;
	if(t == 1) promeni(k);
	else rekonstrukcija(k);
}

int main() {
	int q;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> arr[i];
	prep();
	cin >> q;
	while(q--) solve();
	return 0;
}