#include <bits/stdc++.h>
using namespace std;
const int MAXN = 250005;
struct SEGMENT_TREE {
  int left, right, min, minp;
} Segtree[MAXN * 5];
int n, a[MAXN * 2], b[MAXN * 2];
int f[21][MAXN * 2], g[21][MAXN * 2];
void Build(int p, int l, int r) {
  Segtree[p].left = l;
  Segtree[p].right = r;
  if (l == r)
    Segtree[p].min = b[l], Segtree[p].minp = l;
  else {
    int mid = (Segtree[p].left + Segtree[p].right) >> 1;
    Build(2 * p, l, mid);
    Build(2 * p + 1, mid + 1, r);
    Segtree[p].min = min(Segtree[2 * p].min, Segtree[2 * p + 1].min);
    if (Segtree[2 * p].min < Segtree[2 * p + 1].min)
      Segtree[p].minp = Segtree[2 * p].minp;
    else
      Segtree[p].minp = Segtree[2 * p + 1].minp;
  }
}
int getmin(int p, int l, int r) {
  if (Segtree[p].left == l && Segtree[p].right == r)
    return Segtree[p].minp;
  else {
    int mid = (Segtree[p].left + Segtree[p].right) >> 1;
    if (r <= mid)
      return getmin(2 * p, l, r);
    else if (l > mid)
      return getmin(2 * p + 1, l, r);
    else {
      int x = getmin(2 * p, l, mid), y = getmin(2 * p + 1, mid + 1, r);
      if (b[x] < b[y])
        return x;
      else
        return y;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= 2 * n; i++) {
    b[i] = i - a[i];
    if (b[i] <= 0) b[i] = 1;
  }
  Build(1, 1, 2 * n);
  for (int i = 1; i <= 2 * n; i++) {
    f[0][i] = b[i];
    if (i == 1)
      g[0][i] = 1;
    else
      g[0][i] = getmin(1, b[i], i - 1);
  }
  for (int k = 1; k <= 20; k++)
    for (int i = 1; i <= 2 * n; i++) {
      g[k][i] = g[k - 1][g[k - 1][i]];
      f[k][i] = f[k - 1][g[k - 1][i]];
    }
  long long ans = 0;
  for (int i = n; i >= 1; i--) {
    int x = i + n - 1;
    for (int k = 20; k >= 0; k--)
      if (f[k][x] > i) ans += (1 << k), x = g[k][x];
    if (x > i) ans++;
  }
  printf("%I64d\n", ans);
  return 0;
}
