#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;

int main(){
  int n;
  std::cin >> n;
  vector<int> p(n), cell(n, 1e9);
  for (int i = 0; i < n; i++) {
    std::cin >> p[i];
  }
  queue<pii> que;
  cell[0] = 0;
  que.push(pii(0, 0));
  while(not que.empty()){
    int s = que.front().first;
    int cost = que.front().second;
    que.pop();
    for (int i = 1; i <= 6; i++) {
      int pos = s + i;
      bool flag = false;
      for (int j = 0; j < 2*n; j++) {
        pos = min(n - 1, pos);
        if(p[pos] != 0 and cell[pos] > cost){
          cell[pos] = cost;
          pos += p[pos];
        }else{
          break; 
        }
        if(j == 2*n - 1)flag = true;
      }
      pos = min(n - 1, pos);
      if(flag == true)continue;
      if(cell[pos] > cost + 1){
        cell[pos] = cost + 1;
        que.push(pii(pos, cost + 1));
      }
    }
  }

  std::cout << cell[n - 1] << std::endl;
  return 0;
}