#include <bits/stdc++.h>
using namespace std;
const int maxn = 500005;
int a[maxn], b[maxn], c[maxn][22], f[maxn][22];
int n, t, u;
long long ans;
int ask(int x, int y) {
  if (x <= 0) return 0;
  int k = log2(y - x + 1);
  return b[c[x][k]] < b[c[y - (1 << k) + 1][k]] ? c[x][k]
                                                : c[y - (1 << k) + 1][k];
}
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= int(n); i++) scanf("%d", &a[i]), a[i + n] = a[i];
  for (int i = (1); i <= int(2 * n); i++) b[i] = i - a[i], c[i][0] = i;
  t = 1;
  for (int j = (1); j <= int(20); j++) {
    for (int i = (1); i <= int(2 * n); i++)
      if (i + t - 1 <= 2 * n)
        c[i][j] =
            b[c[i][j - 1]] < b[c[i + t][j - 1]] ? c[i][j - 1] : c[i + t][j - 1];
    t += t;
  }
  for (int i = (1); i <= int(2 * n); i++) f[i][0] = ask(b[i], i);
  for (int j = (1); j <= int(20); j++)
    for (int i = (1); i <= int(2 * n); i++) f[i][j] = f[f[i][j - 1]][j - 1];
  for (int i = 2 * n; i >= n + 1; i--) {
    u = i;
    if (b[i] <= i - n + 1) {
      ans++;
      continue;
    }
    for (int j = 20; j >= 0; j--)
      if (b[f[u][j]] > i - n + 1) u = f[u][j], ans += 1 << j;
    ans += 2;
  }
  printf("%I64d\n", ans);
  return 0;
}
