#include <bits/stdc++.h>
using namespace std;
int a[1000010], f[1000010][20], s[2000010];
long long ans;
int l, r, len, size, cnt, k, n;
int upd(int x, int y) {
  if (a[x] < a[y])
    return x;
  else
    return y;
}
int ask(int l, int r) {
  cnt = 0;
  while (l + 1 < r) {
    if ((l & 1) == 0) cnt = upd(cnt, s[l + 1]);
    if (r & 1) cnt = upd(cnt, s[r - 1]);
    l >>= 1, r >>= 1;
  }
  return cnt;
}
void deals() {
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= 2 * n; i++) a[i] = max(i - a[i], 1);
  a[0] = 2147483647;
  n <<= 1, len = n;
  size = 1;
  while (size < n + 2) size <<= 1;
  for (int i = 1; i <= n; i++) s[size + i] = i;
  for (int i = size - 1; i; i--) s[i] = upd(s[i << 1], s[(i << 1) + 1]);
}
void dealf() {
  n >>= 1;
  for (int i = 2 * n; i; i--) f[i][0] = ask(size + a[i] - 1, size + i);
  for (int i = 1; i <= n * 2; i++)
    for (int j = 1; j <= 19; j++) {
      f[i][j] = f[f[i][j - 1]][j - 1];
      if (f[i][j] == 0) break;
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  deals();
  dealf();
  for (int i = n + 1; i <= 2 * n; i++) {
    k = i;
    for (int j = 19; j >= 0; j--) {
      if (f[k][j] == 0) continue;
      if (a[f[k][j]] > i - n + 1) ans += 1 << j, k = f[k][j];
    }
    if (a[k] > i - n + 1) ans++;
    ans++;
  }
  printf("%I64d\n", ans);
  return 0;
}
