#include<bits/stdc++.h>
using namespace std;
const int M=2e5+10;
int st[M],ed[M],pos[M],a[M],step[M],ne[M];
int n,m,opt,t,x,y,cnt=0;
void reset(int x){
step[x]=0;
int k=x,p=pos[x];
while(k<=ed[p]){
k+=a[k];
step[x]++;
}
if(k>(n-1)) ne[x]=-1;
else ne[x]=k;
}
void build(){
int block=sqrt(n);
int t=n/block;
if(n%block) t++;
for(int i=1;i<=t;i++){
st[i]=(i-1)*block;
ed[i]=i*block-1;
}
ed[t]=n-1;
for(int i=0;i<n;i++){
pos[i]=i/block+1;
reset(i);
}
}
void change(int x,int w){
a[x]=w;
reset(x);
}
int query(int x){
int ans=0,k=x;
while(~k){
ans+=step[k];
k=ne[k];
}
return ans;
}
int main(){
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
build();
cin>>m;
for(int i=1;i<=m;i++){
cin>>opt>>x;
if(opt==1){
cout<<query(x)<<endl;
}else{
cin>>y;
change(x,y);
}
}
return 0;
}