var
n,a,b,i,j,k:integer;
c,d,e:array[1..200] of integer;
begin
assign(input,'lift.in');
reset(input);
readln(n,a,b);
for i:=1 to n do read(c[i]);
close(input);
for i:=1 to n do d[i]:=201;
e[1]:=a;
d[a]:=0;
i:=1;j:=2;
repeat
k:=e[i]+c[e[i]];
if (k<=n)and(d[k]>d[e[i]]+1) then begin e[j]:=k;j:=j+1;d[k]:=d[e[i]]+1;end;
k:=e[i]-c[e[i]];
if (k>0)and(d[k]>d[e[i]]+1) then begin e[j]:=k;j:=j+1;d[k]:=d[e[i]]+1;end;
i:=i+1;
until (i=j)or(d[b]<201);
assign(output,'lift.out');
rewrite(output);
if d[b]<201 then writeln(d[b]) else writeln(-1);
close(output);
end.