#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005, maxd = 20;
int jump[maxd][maxn], range[maxd][maxn];
int a[maxn], L[maxn], lmin[maxd][maxn];
int n;
int getminL(int a, int b) { return L[a] < L[b] ? a : b; }
int getmin(int a, int b) {
  int k = b - a + 1 ? 31 - __builtin_clz(b - a + 1) : 0;
  return getminL(lmin[k][a], lmin[k][b - (1 << k) + 1]);
}
int main() {
  int i, x, d, ld;
  scanf("%d", &n);
  for (ld = 0; (1 << ld) <= n; ++ld)
    ;
  for (i = 1; i <= n; ++i) scanf("%d", a + i), a[i + n] = a[i];
  for (i = 1; i <= n + n; ++i) L[i] = max(i - a[i], 0), lmin[0][i] = i;
  for (d = 1; d < ld; ++d)
    for (i = 1; i <= n + n - (1 << d) + 1; ++i)
      lmin[d][i] = getminL(lmin[d - 1][i], lmin[d - 1][i + (1 << (d - 1))]);
  for (i = 1; i <= n + n; ++i) {
    jump[0][i] = getmin(L[i], i);
    range[0][i] = L[i];
    for (d = 1; range[d - 1][i]; ++d)
      jump[d][i] = jump[d - 1][jump[d - 1][i]],
      range[d][i] = range[d - 1][jump[d - 1][i]];
  }
  long long ans = 0;
  for (i = n; i < n + n; ++i)
    for (d = ld - 1, x = i, ++ans; d >= 0; --d)
      if (range[d][x] > i - n + 1) ans += 1 << d, x = jump[d][x];
  printf("%I64d\n", ans);
  return 0;
}
