#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
const int N=1e6+7;
using namespace std;
int ch[N][2]={0};
int fa[N]={0};
int rev[N]={0};//lazy
int val[N]={0};
int siz[N]={0};
int n,m;
int ed=300000;
inline int getson(int x){
if(ch[fa[x]][1]==x)
return 1;
if(ch[fa[x]][0]==x)
return 0;
return -1;
}
inline void update(int x){
siz[x]=1;
if(x){
if(ch[x][0])
siz[x]+=siz[ch[x][0]];
if(ch[x][1])
siz[x]+=siz[ch[x][1]];
}
}
inline void pushdown(int x){
if(!rev[x])
return;
rev[x]=0;
rev[ch[x][0]]^=1;
rev[ch[x][1]]^=1;
swap(ch[x][0],ch[x][1]);
}
inline void Clear(int x){
if(getson(x)!=-1)
Clear(fa[x]);
pushdown(x);
}
inline void rotate(int x){
int f=fa[x];
int grandf=fa[f];
int l=getson(x);
int r=l^1;
if(getson(f)!=-1){
ch[grandf][ch[grandf][1]==f]=x;
}
fa[ch[x][r]]=f;
fa[f]=x;
fa[x]=grandf;
ch[f][l]=ch[x][r];
ch[x][r]=f;
update(f);
update(x);
}
inline void Splay(int x){
Clear(x);
for(int f=fa[x];getson(x)!=-1;rotate(x),f=fa[x]){
if(getson(f)!=-1)
rotate(getson(f)==getson(x)?f:x);
}
update(x);
}
inline void access(int x){
for(int i=0;x;x=fa[i=x]){
Splay(x);
ch[x][1]=i;
update(x);
}
}
inline void makeroot(int x){
access(x);
Splay(x);
rev[x]^=1;
}
inline void link(int x,int y){
makeroot(x);
fa[x]=y;
}
inline void cut(int x,int y){
makeroot(x);
access(y);
Splay(y);
fa[x]=ch[y][0]=0;
update(y);
}
inline int getans(int x){
makeroot(x);
access(ed);
Splay(ed);
return siz[ed];
}
int main(){
scanf("%d",&n);
ed=n+1;
for(int i=1;i<=ed;i++)
siz[i]=1;
for(int i=1;i<=n;i++){
int u,v;
u=i;
scanf("%d",&v);
if(u+v>n)
link(u,ed);
else
link(u,u+v);
val[i]=v;
}
int m;
scanf("%d",&m);
for(int i=1;i<=m;i++){
int opt;
int u,k;
scanf("%d",&opt);
if(opt==1){
scanf("%d",&u);
u++;
printf("%d\n",getans(u)-1);
}
if(opt==2){
scanf("%d%d",&u,&k);
u++;
if(u+val[u]<ed)
cut(u,u+val[u]);
else
cut(u,ed);
if(u+k<ed)
link(u,u+k);
else
link(u,ed);
val[u]=k;
}
}
}
LCT模板,挺简单的