#include<bits/stdc++.h>
using namespace std;
const int N = 2e5;
struct Node {
int x, step;
};
queue<Node> que;
int a[N], n, k[N], A, B;
bool vis[N], f;
void bfs(int x) {
que.push({x, 0});
vis[x] = 1;
while (!que.empty()) {
Node t = que.front();
que.pop();
for (int i = -1; i <= 1; i += 2) {
int xx = t.x + i * k[t.x];
if (xx >= 1 && xx <= n && vis[xx] == 0) {
vis[xx] = 1;
que.push({xx, t.step + 1});
}
if (xx == B) {
f = 1;
break;
}
}
if (f) break;
}
}
int main() {
cin >> n >> A >> B;
for (int i = 1; i <= n; i++) {
cin >> k[i];
}
bfs(A);
cout << que.back().step;
return 0;
}