import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
static List<Integer> resu = new ArrayList<>();
static int[][] used;
// 贪心算法 每次跳动最大值
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] step = new int[n];
for (int i = 0; i < n; i++) {
step[i] = in.nextInt();
}
used = new int[n][n];
startDri(step, 0, 0);
if (resu.size() > 0) {
Collections.sort(resu);
System.out.println(resu.get(0));
}else
System.out.println(-1);
}
private static void startDri(int[] step, int index, int count) {
if (used[index][count] == 1) {
return;
}
used[index][count] = 1;
if (index + step[index] > step.length - 1) {
resu.add(count + 1);
return;
}
if (step[index] == 0) {
return;
}
int maxLength = index + step[index];
for (int i = index + 1; i < step.length && i <= maxLength; i++) {
startDri(step, i, count + 1);
}
}
}