#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<(int)N;i++)
#define p(S) cout<<(S)<<endl
using namespace std;
const int inf=1e9;

int main(){
	int n;
	cin>>n;
	int dp[100010],effect[100010];
	bool visited[100010];
	REP(i,0,n) cin>>effect[i];
	REP(i,1,n) {
		dp[i]=inf;
		visited[i]=false;
	}
	queue<int> q;
	dp[0]=0;
	visited[0]=true;
	q.push(0);
	//bfs
	while(!q.empty()){
		int now=q.front();q.pop();
		REP(i,1,7){
			int next=now+i;
			if(next>n-1) break;
			while(!visited[next]){
				visited[next]=true;
				if(effect[next]==0){
					dp[next]=dp[now]+1;
					q.push(next);
				}
				next+=effect[next];
			}
		}
		if(dp[n-1]<inf){
			break;
		}
	}
	p(dp[n-1]);
	return 0;
}