#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.size()){
        Node now=q.front();
        if(now.x==b){
            cout<<now.step;
            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: Time Limit Exceed
****************************************************************/