#include <cstdlib>
#include <cmath>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cstdio>
#define rep(i, l, r) for(int i = l; i <= r; i++)
#define down(i, l, r) for(int i = l; i >= r; i--)
#define MS 234567
#define MAX 1037471823
using namespace std;
int n, m, x, y, h[MS], l[MS], r[MS], ph[MS], k[MS], s[MS];
bool rev[MS];
inline void Down(int x)
{ if (rev[x]) { int k; k = l[x], l[x] = r[x], r[x] = k, rev[x]^=1, rev[l[x]]^=1, rev[r[x]]^=1; } }
inline void Cal(int x) { if (!x) return; s[x] = s[l[x]] + s[r[x]] + 1; }
inline void Splay(int x)
{
if (!x) return; Down(x); int o=h[x];
while (o)
{
if (rev[o]) { Down(o); Down(x); } if (!h[o]) ph[x] = ph[o], ph[o] = 0;
if (l[o]==x) { l[h[o]]==o?l[h[o]]=x:r[h[o]]=x; h[x]=h[o]; l[o]=r[x]; h[r[x]]=o; h[o]=x; r[x]=o; Cal(o); }
else { l[h[o]]==o?l[h[o]]=x:r[h[o]]=x; h[x]=h[o]; r[o]=l[x]; h[l[x]]=o; h[o]=x; l[x]=o; Cal(o); }
o=h[x];
}
Cal(x);
}
inline void Acc(int x)
{
int y; for(y = 0; x; y = x, x = ph[x])
{ Splay(x); ph[r[x]]=x, h[r[x]]=0, r[x]=y; if (y) h[y]=x, ph[y]=0; Cal(x); }
}
inline void Evert(int x) { Acc(x); Splay(x); rev[x]^=1; }
inline void Link(int x, int y) { Evert(x); Splay(x); ph[x] = y; }
inline void Cut(int x, int y) { Evert(x); Acc(y); Splay(y); l[y] = h[x] = 0; Cal(y); }
inline void Query(int x, int y) { Evert(x); Acc(y); Splay(y); printf("%d\n", s[y]-1); }
int main()
{
scanf("%d", &n);
rep(i, 1, n) { scanf("%d", &x); if (i+x<=n) k[i] = i+x; else k[i] = n+1; Link(i, k[i]); }
scanf("%d", &m);
rep(i, 1, m)
{
scanf("%d", &x);
if (x == 1) { scanf("%d", &x); x++; Query(n+1, x); }
else
{
scanf("%d%d", &x, &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