#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000007;
int n;
int a[MAXN];
int f[MAXN];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) a[i + n] = a[i];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    f[0] = 0;
    for (int j = 1; j < n; j++) {
      f[j] = n + 1;
      for (int k = max(0, j - a[i + j]); k < j; k++) f[j] = min(f[j], f[k]);
      f[j]++;
    }
    ans += f[n - 1];
  }
  cout << ans << endl;
  return 0;
  for (int i = 0; i < n; i++) {
    int res = 1;
    for (int j = 0, k = i + a[i]; k < i + n - 1;) {
      int f = 0;
      while (j <= k) {
        f = max(f, a[j] + j);
        j++;
      }
      k = f;
      res++;
    }
    ans += res;
  }
  cout << ans << endl;
  return 0;
}
