#include<bits/stdc++.h>
using namespace std;
int n,a,b,k[201],s=INT_MAX;
void dfs(int x,int y,int z){
if(x==y){
s=min(s,z);
return 0;
}
else if(z>=s) return ;
else{
if(x+k[x]<=n) dfs(x+k[x],y,z+1);
if(x-k[x]>0&&x-k[x]<=n) dfs(x-k[x],y,z+1);
}
}
int main(){
scanf("%d%d%d",&n,&a,&b);
for(int i=1;i<=n;i++) scanf("%d",&k[i]);
if(a==b){
printf("0");
return 0;
}
dfs(a,b,0);
printf("%d",s);
return 0;
}
记录