#include <bits/stdc++.h>
using std::max;
const int maxn = 1000010, maxm = 21;
int n, m;
int a[maxn], w[maxn];
int f[maxn][maxm], F[maxn][maxm];
inline int gmin(const int &x, const int &y) { return w[x] < w[y] ? x : y; }
inline int que(const int &x, const int &y) {
  int k = (int)log2((double)(y - x + 1));
  return gmin(f[x][k], f[y - (1 << k) + 1][k]);
}
int main() {
  if (0) {
    freopen("t.in", "r", stdin);
    freopen("t.out", "w", stdout);
  }
  int i, j, s, x;
  long long ans = 0;
  scanf("%d", &n);
  for (m = 0; (1 << m) < 2 * n; ++m)
    ;
  for (i = 1; i <= n; ++i) scanf("%d", a + i), a[i + n] = a[i];
  for (i = 1; i <= 2 * n; ++i) w[i] = i - a[i], f[i][0] = i;
  for (j = 1; j <= m; ++j)
    for (i = 1; i + (1 << j) - 1 <= 2 * n; ++i)
      f[i][j] = gmin(f[i][j - 1], f[i + (1 << j - 1)][j - 1]);
  for (i = 1; i < n * 2; ++i) F[i][0] = que(max(1, w[i]), i);
  for (j = 1; j <= m; ++j)
    for (i = 1; i < n * 2; ++i) F[i][j] = F[F[i][j - 1]][j - 1];
  for (i = n; i < n * 2; ++i) {
    if (w[i] <= i - n + 1) {
      ++ans;
      continue;
    }
    s = 0, x = i;
    for (j = m; j >= 0; --j)
      if (w[F[x][j]] > i - n + 1) x = F[x][j], s += 1 << j;
    ans += s + 2;
  }
  printf("%I64d", ans);
  return 0;
}
