#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long first = 0, f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9';) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  for (; ch >= '0' && ch <= '9';) {
    first = first * 10ll + ch - '0';
    ch = getchar();
  }
  return first * f;
}
long long n, S;
struct node {
  long long v, id;
} b[2 * 20010];
long long a[20010 * 2], f[20010 * 2][105ll];
long long ans, ansmax, ansid;
struct Tree {
  int t[20010 * 4], id[20010 * 4];
  inline void Build(int o, int l, int r, int d) {
    if (l == r) {
      t[o] = f[l][d];
      id[o] = l;
      return;
    }
    int mid = (l + r) >> 1;
    Build(o * 2, l, mid, d), Build(o * 2 + 1, mid + 1, r, d);
    if (t[o * 2] < t[o * 2 + 1])
      id[o] = id[o * 2], t[o] = t[o * 2];
    else
      id[o] = id[o * 2 + 1], t[o] = t[o * 2 + 1];
  }
  inline void Ask(int o, int l, int r, int rl, int rr) {
    if (l == rl && r == rr) {
      if (t[o] < ansmax) ansmax = t[o], ansid = id[o];
      return;
    }
    int mid = (l + r) >> 1;
    if (rr <= mid)
      Ask(o * 2, l, mid, rl, rr);
    else if (rl > mid)
      Ask(o * 2 + 1, mid + 1, r, rl, rr);
    else
      Ask(o * 2, l, mid, rl, mid), Ask(o * 2 + 1, mid + 1, r, mid + 1, rr);
  }
} A[105ll];
inline int cmp(const node &first, const node &second) {
  return first.v < second.v;
}
inline void Solve(long long first) {
  first += n;
  long long last = first;
  long long Tmp = first;
  for (;;) {
    if (last == Tmp) {
      if (f[Tmp][S] > first - n + 1)
        last = Tmp, Tmp = f[Tmp][S], ans += S;
      else {
        for (long long j = 1; j <= S; j++)
          if (f[Tmp][j] <= first - n + 1) {
            ans += j;
            return;
          }
      }
    } else {
      ansmax = 2 * n, ansid = 0;
      A[S].Ask(1, 1, 2 * n, f[last][S], f[last][S - 1] - 1);
      if (ansmax > first - n + 1)
        last = ansid, Tmp = f[ansid][S], ans += S;
      else {
        for (long long j = 1; j <= S; j++) {
          ansmax = 2 * n, ansid = 0;
          A[S].Ask(1, 1, 2 * n, f[last][j], f[last][j - 1] - 1);
          if (ansmax <= first - n + 1) {
            ans += j;
            return;
          }
        }
      }
    }
  }
}
int main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read(), a[n + i] = a[i];
  for (long long i = 1; i <= n * 2; i++) b[i].v = i - a[i], b[i].id = i;
  sort(b + 1, b + 1 + 2 * n, cmp);
  S = (long long)(sqrt(n));
  S = min(S, 105ll - 5);
  for (long long i = 1; i <= 2 * n; i++)
    f[i][1] = max(0ll, i - a[i]), f[i][0] = i;
  A[1].Build(1, 1, 2 * n, 1);
  for (long long i = 1; i <= S - 1; i++)
    for (long long j = 1; j <= 2 * n; j++) {
      if (!f[j][i]) {
        f[j][i + 1] = 0;
        continue;
      }
      ansmax = 2 * n + 1;
      A[1].Ask(1, 1, 2 * n, f[j][i], f[j][i - 1] - 1);
      f[j][i + 1] = ansmax;
    }
  for (long long i = 2; i <= S; i++) A[i].Build(1, 1, 2 * n, i);
  for (long long i = 1; i <= n; i++) Solve(i);
  printf("%I64d\n", ans);
}
