#include <bits/stdc++.h>
using namespace std;
int jump[20][500000], a[500000];
pair<int, int> st[20][500000];
pair<int, int> queryRmq(int a, int b) {
  int t = 31 - __builtin_clz(b - a + 1);
  return min(st[t][a], st[t][b - (1 << t) + 1]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = n; i < n * 2; i++) a[i] = a[i - n];
  for (int i = 0; i < n * 2; i++) st[0][i] = make_pair(max(0, i - a[i]), i);
  for (int i = 1; 1 << i <= n * 2; i++)
    for (int j = 0; j + (1 << i) <= n * 2; j++)
      st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
  for (int i = 0; i < n * 2; i++)
    jump[0][i] = queryRmq(st[0][i].first, i).second;
  for (int i = 1; 1 << i <= n * 2; i++)
    for (int j = 0; j < n * 2; j++) jump[i][j] = jump[i - 1][jump[i - 1][j]];
  long long ans = 0;
  for (int i = n; i < n * 2; i++) {
    if (i - a[i] <= i - n + 1) {
      ans++;
      continue;
    }
    int lg = 0;
    while (1 << lg <= n) lg++;
    int cnt = 0, now = i;
    for (int j = lg - 1; j >= 0; j--) {
      int t = jump[j][now];
      if (t - a[t] > i - n + 1) {
        cnt += 1 << j;
        now = t;
      }
    }
    ans += cnt + 2;
  }
  printf("%I64d\n", ans);
  return 0;
}
