#include<iostream>
#include<algorithm>
#include<queue>

using namespace std;

struct State{
  int pos,t;
  State(){}
  State(int pos, int t):pos(pos),t(t){}
  bool operator < (const State& s) const { return t > s.t;}
};

const int MAX = 100000;
const int INF = (1<<25);
int M[MAX],T[MAX];
int n;

void input(){
  cin >> n;
  for(int i = 0; i < n; i++) cin >> M[i];
}

void solve(){
  fill(T,T+MAX,INF);
  
  priority_queue<State> Q;
  T[0] = 0;
  Q.push(State(0,0));

  while(!Q.empty()){
    State now = Q.top();
    Q.pop();
    
    if(T[now.pos] < now.t) continue;

    for(int i = 1; i <= 6; i++){
      State nex;
      nex.pos = (now.pos+i)%n;
      nex.t = now.t+1;

      while(1){
	if(T[nex.pos] > nex.t){
	  T[nex.pos] = nex.t;
	}else break;
	
	if(M[nex.pos] == 0){
	  Q.push(nex);
	  break;
	}

	nex.pos += M[nex.pos];
      }
    }
  }
  cout << T[n-1] << endl;
}
int main(){
  input();
  solve();
  return 0;
}