#include<iostream>
#include<stack>
#include<cstring>
using namespace std;
struct coord {
int floor,num;
};
coord s[201];
int step[201];
bool flag[201];
stack<coord>q;
int main() {
memset(flag,true,sizeof(flag));
int n,a,b;
cin>>n>>a>>b;
for(int i=1; i<=n; i++) {
cin>>s[i].num;
s[i].floor=i;
}
step[a]=0;
flag[a]=false;
q.push(s[a]);
while(!q.empty()) {
coord now=q.top();
q.pop();
int nf=now.floor,nu=now.num;
int nf1=nf-nu;
int nf2=nf+nu;
if(nf1>1&&flag[nf1]) {
q.push(s[nf1]);
step[nf1]=step[nf]++;
flag[nf]=false;
}
if(nf2<n&&flag[nf2]) {
q.push(s[nf2]);
step[nf2]=step[nf]++;
flag[nf]=false;
}
else continue;
}
cout<<step[b];
return 0;
}