#include <bits/stdc++.h>
using namespace std;
class segm_tree {
  vector<pair<int, int> > tr;
  int off;

 public:
  segm_tree(const vector<int> &as) {
    off = 1;
    while (off < ((int)(as).size())) off <<= 1;
    tr = vector<pair<int, int> >(2 * off, make_pair(-1, -1));
    for (int i = 0; i < ((int)(as).size()); i++)
      tr[off + i] = make_pair(as[i], i);
    for (int i = off - 1; i >= 1; i--) tr[i] = max(tr[2 * i], tr[2 * i + 1]);
  }
  pair<int, int> get(int l, int r) {
    l += off;
    r += off;
    pair<int, int> res(-1, -1);
    while (l <= r) {
      if (l & 1) res = max(res, tr[l++]);
      if (!(r & 1)) res = max(res, tr[r--]);
      l >>= 1;
      r >>= 1;
    }
    return res;
  }
};
const int K = 18;
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    vector<int> as(n);
    for (int i = 0; i < n; i++) scanf("%d", &as[i]);
    reverse(as.begin(), as.end());
    for (int i = 0; i < n; i++) as.push_back(as[i]);
    vector<int> maxr(((int)(as).size()));
    for (int i = 0; i < ((int)(as).size()); i++)
      maxr[i] = min(i + as[i], ((int)(as).size()) - 1);
    segm_tree tr(maxr);
    vector<vector<pair<int, int> > > ne(
        ((int)(as).size()), vector<pair<int, int> >(K, make_pair(-1, -1)));
    for (int i = ((int)(as).size()) - 1; i >= 0; i--) {
      ne[i][0] = make_pair(
          i + 1 == ((int)(as).size()) ? i : tr.get(i + 1, maxr[i]).second, i);
      for (int i2 = 1; i2 < K; i2++)
        ne[i][i2] = ne[ne[i][i2 - 1].first][i2 - 1];
    }
    long long ans = 0;
    for (int i = 0; i < n; i++) {
      int clen = 0, goal = n + i - 1;
      pair<int, int> cv(i, -1);
      for (int i2 = K - 1; i2 >= 0; i2--)
        if (ne[cv.first][i2].first < goal) {
          cv = ne[cv.first][i2];
          assert(cv.second >= 0);
          clen += 1 << i2;
        }
      assert(cv.first < goal);
      assert(ne[cv.first][0].first >= goal);
      if (cv.second >= 0 && maxr[cv.second] >= goal) {
      } else {
        clen++;
      }
      ans += clen;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
