#include <bits/stdc++.h>
using namespace std;
const int N = 500100;
int n, m;
int a[N], e[40], A[N][30], ans[N][30];
int ask(const int x, const int y) {
  if (x == 0) 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 + n; ++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(ans, 0, sizeof(ans));
  for (int i = 1; i <= n + n; ++i) ans[i][0] = ask(a[i], i - 1);
  for (int j = 1; j <= m; ++j)
    for (int i = 1; i <= n + n; ++i) {
      int p = ans[i][j - 1];
      ans[i][j] = ans[p][j - 1];
    }
  long long Ans = 0;
  for (int i = n; i < n + n; ++i) {
    int E = i - n + 1, now = i, p = m, q = 1;
    if (a[now] > E) ++q;
    while (a[now] > E) {
      while (a[ans[now][p]] <= E && p >= 0) --p;
      if (p < 0) break;
      q += e[p];
      now = ans[now][p];
    }
    Ans += q;
  }
  cout << Ans << endl;
  return 0;
}
