#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010, maxk = 30;
int n;
long long ans;
int A[maxn], B[maxn], ST[maxn][maxk], F[maxn][maxk];
int ask(int a, int b) {
  int c, l;
  if (a <= 0) return 0;
  l = b - a + 1;
  c = (int)log2(l);
  return B[ST[a][c]] < B[ST[b - (1 << c) + 1][c]] ? ST[a][c]
                                                  : ST[b - (1 << c) + 1][c];
}
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", &A[i]);
  for (i = 1; i <= n; ++i) A[i + n] = A[i];
  for (i = 1; i <= 2 * n; ++i) B[i] = i - A[i];
  for (i = 1; i <= 2 * n; ++i) ST[i][0] = i;
  for (j = k = 1; j <= 20; ++j, k += k)
    for (i = 1; i <= 2 * n; ++i)
      if (i + k - 1 <= 2 * n)
        ST[i][j] = B[ST[i][j - 1]] < B[ST[i + k][j - 1]] ? ST[i][j - 1]
                                                         : ST[i + k][j - 1];
  for (i = 1; i <= 2 * n; ++i) F[i][0] = ask(B[i], i);
  for (j = 1; j <= 20; ++j)
    for (i = 1; i <= 2 * n; ++i) F[i][j] = F[F[i][j - 1]][j - 1];
  for (i = 2 * n; i > n; --i) {
    if (B[i] <= i - n + 1) {
      ans++;
      continue;
    }
    for (j = i, k = 20; k >= 0; --k)
      if (B[F[j][k]] > i - n + 1) j = F[j][k], ans += (1 << k);
    ans += 2;
  }
  printf("%I64d", ans);
  return 0;
}
