#include <bits/stdc++.h>
using namespace std;
struct Node
{
int num, step;
};
queue<Node> q;
bool vis[205];
int k[205], n, a, b;
int bfs(int x)
{
Node node;
node.num = x;
node.step = 0;
q.push(node);
while (!q.empty())
{
node = q.front();
q.pop();
if (node.num == b)
return node.step;
Node tmpnode;
tmpnode.num = node.num + k[node.num];
if (tmpnode.num >= 1 && tmpnode.num <= n)
{
vis[tmpnode.num] = true;
tmpnode.step = node.step + 1;
q.push(tmpnode);
}
tmpnode.num = node.num - k[node.num];
if (tmpnode.num >= 1 && tmpnode.num <= n)
{
vis[tmpnode.num] = true;
tmpnode.step = node.step + 1;
q.push(tmpnode);
}
}
}
int main()
{
cin >> n >> a >> b;
for (int i = 1; i <= n; i++)
cin >> k[i];
cout << bfs(a) << endl;
return 0;
}