#include<bits/stdc++.h>
using namespace std;
#define MAX 210
struct fff{
int floor;
int t;
}f;
int N,A,B;
int vis[MAX];
int a[MAX];
int main()
{
queue<fff> q;
cin>>N>>A>>B;
for(int i=1;i<=N;++i)
cin>>a[i];
q.push({A,0});
while(!q.empty())
{
f=q.front();
vis[f.floor]=1;
if(f.floor==B)
{
cout<<f.t;
return 0;
}
q.pop();
int x1=f.floor+a[f.floor];
int x2=f.floor-a[f.floor];
if(x1<=N)
if(vis[x1]!=1)
q.push({x1,++f.t});
if(x2>0)
if(vis[x2]!=1)
q.push({x2,++f.t});
}
cout<<-1;
return 0;
}