#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Max(T a, T b) {
  if (a > b)
    return a;
  else
    return b;
}
template <class T>
inline T Min(T a, T b) {
  if (a < b)
    return a;
  else
    return b;
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T TripleMax(T a, T b, T c) {
  return Max(Max(a, b), c);
}
template <class T>
inline T TripleMin(T a, T b, T c) {
  return Min(Min(a, b), c);
}
const int maxn = 500512;
int a[maxn], e[40], A[maxn][30], res[maxn][30], n, m;
int orzask(int x, int y) {
  if (!x) return 0;
  int k = 0;
  while (x + e[k + 1] - 1 < y) ++k;
  return a[A[x][k]] <= a[A[y - e[k] + 1][k]] ? A[x][k] : A[y - e[k] + 1][k];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    A[i + n][0] = i + n, A[i][0] = i;
    a[i + n] = max(i + n - a[i], 0);
    a[i] = max(i - a[i], 0);
  }
  a[0] = 0, e[0] = 1;
  for (int i = 1; i <= 30; ++i) e[i] = e[i - 1] << 1;
  for (m = 1; e[m] <= n * 2; m++) {
    int i = 1;
    for (i = 1; i + e[m] - 1 <= n + n; i++)
      A[i][m] = (a[A[i][m - 1]] <= a[A[i + e[m - 1]][m - 1]]
                     ? A[i][m - 1]
                     : A[i + e[m - 1]][m - 1]);
    for (; i <= n + n; ++i) A[i][m] = A[i - 1][m];
  }
  memset(res, 0, sizeof(res));
  for (int i = 1; i <= n + n; ++i) res[i][0] = orzask(a[i], i - 1);
  for (int j = 1; j <= m; ++j)
    for (int i = 1; i <= n + n; ++i) {
      int p = res[i][j - 1];
      res[i][j] = res[p][j - 1];
    }
  long long ans = 0;
  for (int i = n; i < n + n; ++i) {
    int E = i - n + 1, orzluogan = i, p = m, q = 1;
    if (a[orzluogan] > E) q++;
    while (a[orzluogan] > E) {
      while (a[res[orzluogan][p]] <= E && p >= 0) --p;
      if (p < 0) break;
      q += e[p];
      orzluogan = res[orzluogan][p];
    }
    ans += q;
  }
  cout << ans << endl;
  return 0;
}
