#include <bits/stdc++.h>
using namespace std;
int n;
int a[250010], b[500010], f[500010][19], st[500010][19], w[500010];
long long ans;
int read() {
  int ret = 0;
  char ch = getchar();
  while (ch < 48 || ch > 57) ch = getchar();
  while (ch >= 48 && ch <= 57) ret = ret * 10 + ch - 48, ch = getchar();
  return ret;
}
int main() {
  int i, j, x, y, z;
  n = read();
  for (i = 1; i <= n; i++) {
    a[i] = read();
    b[i] = max(1, i - a[i]);
    b[n + i] = max(1, n + i - a[i]);
  }
  for (i = 1; i <= 2 * n; i++) st[i][0] = i;
  for (j = 1; j <= 18; j++)
    for (i = 1; i <= 2 * n - (1 << j) + 1; i++) {
      x = st[i][j - 1];
      y = st[i + (1 << (j - 1))][j - 1];
      st[i][j] = b[x] < b[y] ? x : y;
    }
  for (i = 2; i <= n; i++) w[i] = w[i / 2] + 1;
  for (i = 2; i <= 2 * n; i++) {
    z = w[i - b[i]];
    x = st[b[i]][z];
    y = st[i - (1 << z)][z];
    if (b[x] < b[y])
      f[i][0] = x;
    else
      f[i][0] = y;
    for (j = 1; j <= 18; j++) f[i][j] = f[f[i][j - 1]][j - 1];
  }
  for (i = 1; i <= n; i++) {
    x = n + i - 1;
    if (b[x] <= i)
      ans++;
    else {
      for (j = 18; j >= 0; j--)
        if (b[f[x][j]] > i) {
          ans += (1 << j);
          x = f[x][j];
        }
      ans += 2;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
