#include <bits/stdc++.h>

#define maxn 100001

typedef long long ll;

using namespace std;

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

void bits(ll br) {
	while(br > 0) {
		cout << (br & 1) << "\n";
		br = br >> 1;
	}
}

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

void solve() {
	ll t, k;
	cin >> t >> k;
	if(t == 1) {
		ll x, j;
		cin >> x;
		ll 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++;
		}
	} else {
		ll c = 1, br = 0;
		for(ll i = 0; i < 18; i++) {
			if(bitovi[i] >= k) br += c;
			c = c << 1;
		}
		cout << br << "\n";
	}
}

int main() {
	ll q;
	cin >> n;
	for(ll i = 0; i < n; i++) cin >> arr[i];
	prep();
	cin >> q;
	while(q--) solve();
//	for(int i = 0; i < 18; i++) {
//		cout << i << ": " << bitovi[i] << "\n";
//	}
	return 0;
}