#include<bits/stdc++.h>
using namespace std;
int n=0,k[205]={},ans[205]={},a=0,b=0;
queue <int> que;
bool pd[205]={};
int bfs()
{
int now=0,nxt=0;
if(a==b)
return 0;
que.push(a);
ans[a]=0;
while(!que.empty())
{
now=que.front();
if(now==b)
return ans[now];
que.pop();
pd[now]=1;
nxt=now+k[now];
if(!pd[nxt]&&nxt<=n)
{
que.push(nxt);
ans[nxt]=ans[now]+1;
}
nxt=now-k[now];
if(!pd[nxt]&&nxt>=1)
{
que.push(nxt);
ans[nxt]=ans[now]+1;
}
}
return -1;
}
int main()
{
int i=0;
cin>>n>>a>>b;
for(i=1;i<=n;i++)
{
cin>>k[i];
}
cout<<bfs();
}