#include <bits/stdc++.h>
using namespace std;
int dl[250001];
long long head, tail;
int a[500001];
int f[500001][20];
int fa[500001][20];
long long t2[20];
int n;
long long ans;
int find(int l, int r) {
  int k = 0;
  while ((1 << (k + 1)) <= r - l + 1) k++;
  return min(f[l][k], f[r - (1 << k) + 1][k]);
}
int findf(int l, int r) {
  if (l == r) return l;
  int mid = (l + r) / 2;
  if (find(l, mid) <= find(mid + 1, r))
    return findf(l, mid);
  else
    return findf(mid + 1, r);
}
long long solve(int k) {
  if (k - a[k] <= k - n + 1) return 1;
  long long u = 0;
  int v = k;
  for (int i = 19; i >= 0; i--)
    if (find(fa[v][i], k) > k - n + 1) {
      u += t2[i];
      v = fa[v][i];
    }
  return u + 2;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
    f[i][0] = i - a[i];
    f[i + n][0] = i + n - a[i];
  }
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= 2 * n; j++)
      f[j][i] = min(f[j][i - 1], f[min(2 * n, j + (1 << (i - 1)))][i - 1]);
  for (int i = 2; i <= 2 * n; i++)
    fa[i][0] = findf(max(max(1, i - a[i]), i - n + 1), i - 1);
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= 2 * n; j++) fa[j][i] = fa[fa[j][i - 1]][i - 1];
  t2[0] = 1;
  for (int i = 1; i <= 19; i++) t2[i] = t2[i - 1] << 1;
  for (int i = n; i <= 2 * n - 1; i++) ans += solve(i);
  printf("%I64d\n", ans);
  return 0;
}
