#include <bits/stdc++.h>
using namespace std;
int n, ans, a[20001], f[20001], q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], a[n + i] = a[i];
  for (int i = n - 1; i < 2 * n - 1; i++) {
    int l = i - 1, r = i - n + 1;
    f[i] = 0;
    for (int j = i; j > r; j--) {
      q = max(r, j - a[j]);
      while (l >= q) f[l] = f[j] + 1, l--;
    }
    ans += f[r];
  }
  cout << ans;
  return 0;
}
