#include <bits/stdc++.h>
const int maxn = 500200;
const double LOG = log(2);
int n, a[maxn], L[maxn], fore[maxn][21], range[maxn][21], prev[maxn][21];
inline int max(int x, int y) { return x < y ? y : x; }
inline int cmp(int x, int y) { return L[x] < L[y] ? x : y; }
inline int query(int l, int r) {
  int e = log(r - l + 1) / LOG;
  return cmp(prev[l][e], prev[r - (1 << e) + 1][e]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i), a[i + n] = a[i];
  for (int i = 1; i <= n + n; i++) L[i] = max(0, i - a[i]), prev[i][0] = i;
  for (int e = 1; (1 << e) <= n; e++)
    for (int i = 1; i <= n + n - (1 << e) + 1; i++)
      prev[i][e] = cmp(prev[i][e - 1], prev[i + (1 << (e - 1))][e - 1]);
  for (int i = 1; i <= n + n; i++) {
    fore[i][0] = query(L[i], i);
    range[i][0] = L[i];
    for (int e = 1; range[i][e - 1]; e++) {
      fore[i][e] = fore[fore[i][e - 1]][e - 1],
      range[i][e] = range[fore[i][e - 1]][e - 1];
    }
  }
  long long ans = 0;
  for (int i = n; i < n + n; i++) {
    int cnt = 0, now = i;
    for (int e = 20; e >= 0; e--)
      if (range[now][e] > i - n + 1) cnt += 1 << e, now = fore[now][e];
    ans += cnt + 1;
  }
  printf("%I64d\n", ans);
}
