#include <bits/stdc++.h>
int N, i, j, x;
long long Ans;
int A[500005], f[500005][20], g[500005][20];
int Min(int a, int b) {
  if (A[a] < A[b]) return a;
  return b;
}
int GetMin(int r, int l) {
  int res = r, i;
  if (l <= 0) l = 1;
  for (i = 19; i >= 0; --i)
    if (r - (1 << i) + 1 >= l) res = Min(res, g[r][i]), r -= 1 << i;
  return res;
}
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];
  for (i = 1; i <= 2 * N; ++i) A[i] = i - A[i];
  for (i = 1; i <= 2 * N; ++i) g[i][0] = i;
  for (i = 1; i < 20; ++i)
    for (j = 1; j <= 2 * N; ++j)
      if (j <= 1 << i - 1)
        g[j][i] = g[j][i - 1];
      else
        g[j][i] = Min(g[j][i - 1], g[j - (1 << i - 1)][i - 1]);
  for (i = 1; i <= 2 * N; ++i) f[i][0] = GetMin(i, A[i]);
  for (i = 1; i < 20; ++i)
    for (j = 1; j <= 2 * N; ++j)
      if (A[f[j][i - 1]] <= j - N + 1)
        f[j][i] = f[j][i - 1];
      else
        f[j][i] = f[f[j][i - 1]][i - 1];
  for (i = 2 * N; i > N; --i) {
    if (A[i] <= i - N + 1) {
      ++Ans;
      continue;
    }
    Ans += 2ll;
    for (x = i, j = 19; j >= 0; --j)
      if (A[f[x][j]] > i - N + 1) Ans += 1ll << j, x = f[x][j];
  }
  printf("%I64d\n", Ans);
  return 0;
}
