#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500000 + 10;
long long ans;
int n, a[MAX_N], st[MAX_N][20], lg[MAX_N], minv[MAX_N][20], fa[MAX_N][20];
int ask_minv(int x, int d) {
  int p = st[x][lg[d]], q = st[x + d - (1 << lg[d])][lg[d]];
  return a[p] <= a[q] ? p : q;
}
int ask(int x, int d) {
  int ret = 1;
  while (a[x] <= d) return ret;
  for (int j = 19; j >= 0; j--)
    if (minv[x][j] > d) {
      ret += 1 << j;
      x = fa[x][j];
    }
  return ret + 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    st[i][0] = i;
  }
  for (int i = n + 1; i <= n + n; i++) {
    a[i] = a[i - n];
    st[i][0] = i;
  }
  n <<= 1;
  for (int i = 1; i <= n; i++) a[i] = max(i - a[i], 1);
  lg[1] = 0;
  for (int i = 2; i <= n; i++) lg[i] = lg[i - 1] + (i == (i & -i));
  for (int i = n; i >= 1; i--) {
    int j;
    for (j = 1; j < 20 && i + (1 << j - 1) <= n; j++) {
      int x = st[i][j - 1], y = st[i + (1 << j - 1)][j - 1];
      if (a[x] <= a[y])
        st[i][j] = x;
      else
        st[i][j] = y;
    }
    for (; j < 20; j++) st[i][j] = st[i][j - 1];
  }
  fa[1][0] = 1;
  minv[1][0] = 1;
  for (int i = 2; i <= n; i++) {
    int pre = ask_minv(a[i], i - a[i]);
    fa[i][0] = pre;
    minv[i][0] = a[pre];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j < 20; j++) {
      fa[i][j] = fa[fa[i][j - 1]][j - 1];
      minv[i][j] = minv[fa[i][j - 1]][j - 1];
    }
  for (int i = 1; i <= n / 2; i++) ans += ask(i + n / 2 - 1, i);
  cout << ans << endl;
  return 0;
}
