#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
#define NMAX 210
int n, s, d, ans = 0, flag = 0;
int a[NMAX], b[NMAX], c[NMAX];
queue<int> q;
int main(void)
{
cin >> n >> s >> d;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
memset(b, 0, sizeof(b));
memset(c, 0, sizeof(c));
q.push(s); b[s] = 1; c[s] = 0;
while (!q.empty())
{
int loc = q.front(); q.pop();
if (loc == d) {
flag = 1;
break;
}
int x1 = loc + a[loc], x2 = loc - a[loc];
if (x1 >= 1 && x1 <= n && b[x1] == 0) {
q.push(x1);
c[x1] = c[loc] + 1;
b[x1] = 1;
}
if (x2 >= 1 && x2 <= n && b[x2] == 0) {
q.push(x2);
c[x2] = c[loc] + 1;
b[x1] = 1;
}
}
if (flag) cout << c[d]-1 << endl;
else cout << -1 << endl;
return 0;
}