#include<bits/stdc++.h>   using namespace std;   #define pb push_back   #define reg register   #define int long long   #define For(i,a,b) for(reg int i=a;i<=b;++i)   #define Down(i,a,b) for(reg int i=a;i>=b;--i)    #define ull unsigned long long   #define rep(i,a,b) for(reg int i=a;i<=b;++i)   #define ll long long   inline int max(int x,int y){return x>y?x:y;}   inline int min(int x,int y){return x<y?x:y;}   inline void ckmin(int &x,int y){x=x<y?x:y; return ;}   inline void ckmax(int &x,int y){x=x>y?x:y; return ;}   inline int gcd(int n,int m){return m?gcd(m,n%m):n;}   inline int lcm(int x,int y){return x/gcd(x,y)*y;}   inline void swap(int &x,int &y){int t=x; x=y; y=t; return ;}   namespace yspm{    inline int read(){        int res=0,f=1; char k;        while(!isdigit(k=getchar())) if(k== - ) f=-1;        while(isdigit(k)) res=res*10+k- 0 ,k=getchar();        return res*f;       }       char out[100];       inline void print(int x){           if(!x) return putchar( 0 ),putchar(  n ),void();           if(x<0) putchar( - ),x=-x;            int cnt=0; while(x) out[++cnt]=x%10,x/=10;            Down(i,cnt,1) putchar(out[i]+ 0 ); putchar(  n ); return ;       }        const int N=1e5+10,bl=510;       vector<int>f[N<<2];       int n,a[N],p,v;       inline void push_up(int x){           int rpos=0,lsz=f[x<<1].size(),rsz=f[x<<1|1].size(); f[x].clear();           for(reg int i=0;i<lsz;){               if(rpos==rsz||(f[x<<1][i]<f[x<<1|1][rpos]-i)) f[x].push_back(f[x<<1][i++]);               else f[x].push_back(f[x<<1|1][rpos++]-i);           } for(reg int j=rpos;j<rsz;++j) f[x].push_back(f[x<<1|1][j]-lsz);           return ;       }       inline void build(int p,int l,int r){           if(l==r) return f[p].resize(1),f[p][0]=a[l],void(); int mid=(l+r)>>1;            build(p<<1,l,mid); build(p<<1|1,mid+1,r);            if(r-l+1<=bl) push_up(p); return ;       }       inline void modify(int x,int l,int r){           if(l==r) return f[x][0]=a[l],void(); int mid=(l+r)>>1;            if(p<=mid) modify(x<<1,l,mid); else modify(x<<1|1,mid+1,r);            if(r-l+1<=bl) push_up(x); return ;       }       inline void query(int x,int l,int r){           if(l>=p&&r-l+1<=bl) return v+=upper_bound(f[x].begin(),f[x].end(),v)-f[x].begin(),void(); int mid=(l+r)>>1;            if(mid>=p) query(x<<1,l,mid); return query(x<<1|1,mid+1,r);        }    signed main(){        n=read(); rep(i,1,n) a[i]=i-read(); build(1,1,n);         int Q=read(); while(Q--){            if(read()==1){                int x=read(),y=read();                 a[x]=x-y; p=x; modify(1,1,n);            }else{                p=read(); if(p==n) print(a[n]);                 else v=a[p],++p,query(1,1,n),print(v);            }        } return 0;       }   }signed main(){return yspm::main();}   //Use The Time To Enrich This Selfclosing Youth