#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
const int INF = 2147483647;
const int MAXN = 2e2 + 50;
int k[MAXN];
bool vis[MAXN];
int n;
int a, b;
int ans = INF;
void dfs(int now, int d)
{
vis[now] = true;
if (now == b)
{
ans = min(ans, d);
return ;
}
for (int i = 0;i <= 1;i++)
{
int next;
if (i == 1)
next = now - k[now];
else
next = now + k[now];
if (next < 1 || n < next)
continue;
if (vis[next])
continue;
dfs(next, d + 1);
}
}
int main()
{
scanf("%d %d %d", &n, &a, &b);
for (int i = 1;i <= n;i++)
scanf(" %d", &k[i]);
if (a == b)
{
printf("0");
return 0;
}
dfs(a,0);
if (ans == INF)
{
printf("-1");
return 0;
}
printf("%d", ans);
return 0;
}