#include <bits/stdc++.h>
using namespace std;
const int N = 500004;
int a[N], w[N], n, f[22][N];
int fa[22][N];
int mn(int x, int y) { return w[x] < w[y] ? x : y; }
int lg[N], g = -1;
int que(int x, int y) {
  if (x < 1) return 1;
  int h = lg[y - x + 1];
  return mn(f[h][x], f[h][y - (1 << h) + 1]);
}
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++) {
    w[i] = i - a[i];
    f[0][i] = i;
    if ((i & -i) == i) ++g;
    lg[i] = g;
  }
  for (int i = 1; i <= g; i++)
    for (int j = 1; j + (1 << i) - 1 <= n + n; j++)
      f[i][j] = mn(f[i - 1][j], f[i - 1][j + (1 << i - 1)]);
  for (int j = 1; j <= n + n; j++) fa[0][j] = (w[j] <= 0 ? 1 : que(w[j], j));
  for (int i = 1; i <= g; i++)
    for (int j = 1; j <= n + n; j++) fa[i][j] = fa[i - 1][fa[i - 1][j]];
  long long ans = 0;
  for (int i = n + 1; i <= n + n; i++) {
    ans += 1 + (w[i] > i - n + 1);
    for (int j = g, k = i; j >= 0; j--) {
      if (w[fa[j][k]] > i - n + 1) k = fa[j][k], ans += 1 << j;
    }
  }
  printf("%lld\n", ans);
}
