#include <bits/stdc++.h>

typedef long long ll;

using namespace std;

int main() {
	ll n, q;
	cin >> n;
	ll arr[n], bitovi[18];
	for(int i = 0; i < 18; i++) bitovi[i] = 0;
	for(ll i = 0; i < n; i++) {
		cin >> arr[i];
		ll cur = arr[i], j = 0;
		while(cur > 0) {
			bitovi[j] += (cur & 1);
			cur = cur >> 1;
			j++;
		}
	} 
	cin >> q;
	while(q--) {
		ll t, k;
		cin >> t >> k;
		if(t == 1) {
			//promena
			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++;
			}
			arr[k - 1] = x;
		} else {
			//provera
			ll c = 1, r = 0;
			for(ll i = 0; i < 18; i++) {
				if(bitovi[i] >= k) {
					r += c;
				}
				c = c << 1;
			}
			cout << r << "\n";
		}
	}
	return 0;
}