#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
    ios_base::sync_with_stdio(false);
//    cin.tie(0);
    const int M = 30;
    int n; cin >> n;
    vector<int> cnt(M);
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++){
        int x = a[i], j = 0;
        while(x > 0){
            cnt[j] += x%2;
            x /= 2;
            j++;
        }
    }
//    for(int i = 0; i < M; i++) cout << cnt[i] << " "; cout << "\n";
    int q; cin >> q;
    while(q--){
        int t, k, x;
        cin >> t >> k; k--;
        if(t == 1){
            cin >> x;
            int stari = a[k];
            a[k] = x;
            int p = 0;
            while(x > 0 || stari > 0){
                cnt[p] -= stari%2;
                cnt[p] += x%2;
                x /= 2;
                stari /= 2;
                p++;
            }
        }else{
            int rez = 0;
            for(int i = 0; i < M; i++){
                if(cnt[i]-k > 0){
//                    cout << "dodajem " << (cnt[i]-k) << endl;
                    rez += 1 << i;
                }
            }
            cout << rez << "\n";
        }
    }
}