#include <bits/stdc++.h>
using namespace std;
pair<int, int> ST[500500][20];
long long Ans;
int Log2[500500], n, a[500500], F[500500][20], head[500500], cnt;
struct Edge {
  int to, next;
} edge[500500];
void AddEdge(int u, int v) { edge[++cnt] = (Edge){v, head[u]}, head[u] = cnt; }
void Dfs(int u, int fa, int dep) {
  F[u][0] = fa;
  for (int i = 1; 1 << i < dep; i++) F[u][i] = F[F[u][i - 1]][i - 1];
  for (int i = head[u]; i; i = edge[i].next) Dfs(edge[i].to, u, dep + 1);
}
pair<int, int> Min(int l, int r) {
  int len = r - l + 1, Log = Log2[len];
  return min(ST[l][Log], ST[r - (1 << Log) + 1][Log]);
}
int Calc(int u, int tar) {
  int ret = 0;
  if (a[u] <= tar) return 1;
  for (int i = 19; i >= 0; i--)
    if (a[F[u][i]] > tar) u = F[u][i], ret += 1 << i;
  return ret + 2;
}
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 <= 2 * n; i++) a[i] = max(i - a[i], 1);
  for (int i = 1; i <= 2 * n; i++) ST[i][0] = make_pair(a[i], i);
  for (int i = 1; i <= 19; i++)
    for (int j = 1; j <= 2 * n; j++)
      if (j + (1 << i - 1) <= 2 * n)
        ST[j][i] = min(ST[j][i - 1], ST[j + (1 << i - 1)][i - 1]);
  for (int i = 2; i <= 2 * n; i++) Log2[i] = Log2[i >> 1] + 1;
  for (int i = 2; i <= 2 * n; i++) AddEdge(Min(a[i], i - 1).second, i);
  Dfs(1, 0, 1);
  for (int i = 1; i <= n; i++) Ans += Calc(i + n - 1, i);
  printf("%I64d\n", Ans);
}
