#include <bits/stdc++.h>
using namespace std;
int a[500001], i, j, n, mi[500001][20], mm[500001][20], ne[500001][20];
long long ans, xxx;
int ask(int l, int r) {
  int o = floor(log(r - l + 1) / log(2));
  return ((mi[l][o] < mi[(r - (1 << o)) + 1][o] ? mm[l][o]
                                                : mm[(r - (1 << o)) + 1][o]));
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = n + 1; i <= 2 * n; i++)
    a[i] = a[i - n], a[i] = max(i - a[i], 0),
    a[i - n] = max(i - n - a[i - n], 0);
  for (i = 1; i <= 2 * n; i++) mi[i][0] = a[i], mm[i][0] = i;
  ;
  for (i = 1; i <= 19; i++)
    for (j = 1; j <= 2 * n - (1 << i) + 1; j++) {
      mi[j][i] = mi[j][i - 1];
      mm[j][i] = mm[j][i - 1];
      if (mi[j + (1 << (i - 1))][i - 1] < mi[j][i])
        mi[j][i] = mi[j + (1 << (i - 1))][i - 1],
        mm[j][i] = mm[j + (1 << (i - 1))][i - 1];
    }
  for (i = 1; i <= 2 * n; i++) ne[i][0] = ask(a[i], i);
  for (i = 1; i <= 19; i++)
    for (j = 1; j <= 2 * n; j++) ne[j][i] = ne[ne[j][i - 1]][i - 1];
  for (i = n; i < n * 2; i++) {
    ans++;
    if (a[i] <= i - n + 1) continue;
    int now = i;
    for (j = 19; j >= 0; j--) {
      if (a[ne[now][j]] > i - n + 1) {
        now = ne[now][j];
        xxx = 1 << j;
        ans += xxx;
      }
    }
    ans++;
  }
  cout << ans;
}
