import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void main() {
    int N; scanf("%d\n", &N);
    int[] P = new int[N];
    foreach (i; 0 .. N) {
        scanf("%d\n", &P[i]);
    }

    auto next = new int[N];
    void init() {
        next[] = -1;
        int dfs(int index) {
            if (next[index] >= 0) return next[index];
            if (P[index] == 0) return next[index] = index;
            if (next[index] == -2 || next[index] == -3) return -3;
            next[index] = -2;
            next[index] = dfs(index + P[index]);
            return next[index];
        }
        foreach (i; 0 .. N) dfs(i);
    }
    init;
    
    bool[] used = new bool[N];
    int[] memo = new int[N];
    memo[] = -1;
    int dfs(int index) {
        if (index == N - 1) return 0;
        //writeln(index);
        if (index + 6 >= N) return 1;
        if (memo[index] >= 0) return memo[index];
        int Ret = int.max / 2;
        foreach (i; 1 .. 7) {
            int n = next[index + i];
            if (n == -3) continue;
            if (used[n]) continue;
            used[n] = true;
            Ret = min(Ret, dfs(n) + 1);
            used[n] = false;
        }
        return memo[index] = Ret;
    }
    writeln(dfs(0));

    //writeln(next);
}