#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5, Log = 20;
long long ans;
int n, a[N], log_2[N], st[N][Log], fa[N][Log], mininum[N][Log];
inline int get_min(int x, int d) {
  int t1 = st[x][log_2[d]], t2 = st[(x) + (d) - (1 << log_2[d])][log_2[d]];
  return a[t1] <= a[t2] ? t1 : t2;
}
int dist(int x, int s) {
  int res = 1;
  if (a[x] <= s) return res;
  for (int l = Log - 1; ~l; --l)
    if (mininum[x][l] > s) res += 1 << l, x = fa[x][l];
  return res + 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 <= 2 * 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);
  log_2[1] = 0;
  for (int i = 2; i <= n; ++i) log_2[i] = log_2[i - 1] + (i == (i & -i));
  for (int i = n, l, t1, t2; i; --i) {
    for (l = 1; l < Log && i + (1 << l - 1) <= n; ++l) {
      t1 = st[i][l - 1], t2 = st[i + (1 << l - 1)][l - 1];
      if (a[t1] <= a[t2])
        st[i][l] = t1;
      else
        st[i][l] = t2;
    }
    for (; l < Log; ++l) st[i][l] = st[i][l - 1];
  }
  fa[1][0] = 1, mininum[1][0] = 1;
  for (int i = 2, x, d, f; i <= n; ++i)
    x = a[i], d = i - x, f = get_min(x, d), fa[i][0] = f, mininum[i][0] = a[f];
  for (int i = 1; i <= n; ++i)
    for (int l = 1; l < Log; ++l)
      fa[i][l] = fa[fa[i][l - 1]][l - 1],
      mininum[i][l] = mininum[fa[i][l - 1]][l - 1];
  for (int i = 1; i <= n >> 1; ++i) ans += dist(i + (n >> 1) - 1, i);
  printf("%I64d\n", ans);
}
