#include<bits/stdc++.h>
using namespace std;
int n,b,a,k[202],ans[202],w;
struct Node{
int x,step;
};
void Bfs(){
queue<Node> q;
q.push({a,0});
while(!q.empty()){
Node now=q.front();
if(now.x==b){
cout<<now.step;
w=1;
return;
}
if(now.step>=1000){
cout<<-1;
w=1;
return;
}
for(int i=1;i<=2;i++){
int tx=now.x+k[now.x];
if(tx>=1&&tx<=n){
q.push({tx,now.step+1});
}
k[now.x]=-k[now.x];
}
q.pop();
}
}
int main(){
cin>>n>>a>>b;
for(int i=1;i<=n;i++) cin>>k[i];
Bfs();
if(w==0)
{
cout<<-1;
}
}
/**************************************************************
Problem: 1819
User: wuyunfeng
Language: C++
Result: Accepted
Time:21 ms
Memory:2080 kb
****************************************************************/