#include <bits/stdc++.h>
using namespace std;
const int N = 1048576, INF = N;
int n;
int a[N];
int d[N];
int main() {
  cin >> n;
  for (int i = (0); i < (int)(n); i++) cin >> a[i];
  copy(a, a + n, a + n);
  long long ans = 0LL;
  for (int i = (0); i < (int)(n); i++) {
    int e = i + n - 1;
    d[e] = 0;
    for (int j = e - 1; j >= i; j--) {
      d[j] = INF;
      for (int k = j + 1; k <= e; k++) {
        if (j + a[k] >= k) d[j] = min(d[j], d[k] + 1);
      }
    }
    ans += d[i];
  }
  cout << ans << endl;
  return 0;
}
