#include <bits/stdc++.h>
using namespace std;
int m = 10000000, n;
void check(int* a, int i, int cnt) {
  if (i == n - 1) {
    if (cnt < m) m = cnt;
  }
  int j;
  for (j = n - 1; j > i; j--) {
    if (i >= j - a[j]) return check(a, j, cnt + 1);
  }
  return;
}
void swap(int* a, int n) {
  int i, tp, tp2;
  int* b = new int[n];
  b[0] = a[n - 1];
  for (i = 1; i < n; ++i) b[i] = a[i - 1];
  for (i = 0; i < n; ++i) a[i] = b[i];
  return;
}
int main(void) {
  int i, j, val, tot = 0;
  scanf("%d", &n);
  int* a = new int[n];
  for (i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (i = 0; i < n; ++i) {
    check(a, 0, 0);
    tot += m;
    m = 10000000;
    swap(a, n);
  }
  printf("%d\n", tot);
  return 0;
}
