#include <bits/stdc++.h>
using namespace std;
int n, a[501000], b[501000], c[501000][25], f[501000][25];
long long ans;
int ask(int x, int y) {
  if (x <= 0) return 0;
  int k = log2(y - x + 1);
  if (b[c[x][k]] < b[c[y - (1 << k) + 1][k]])
    return c[x][k];
  else
    return c[y - (1 << k) + 1][k];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= 2 * n; i++) b[i] = i - a[i];
  int t = 1;
  for (int i = 1; i <= 2 * n; i++) c[i][0] = i;
  for (int j = 1; j <= 20; j++) {
    for (int i = 1; i <= 2 * n; i++)
      if (i + t - 1 <= 2 * n)
        if (b[c[i][j - 1]] < b[c[i + t][j - 1]])
          c[i][j] = c[i][j - 1];
        else
          c[i][j] = c[i + t][j - 1];
    t += t;
  }
  for (int i = 1; i <= 2 * n; i++) f[i][0] = ask(b[i], i);
  for (int j = 1; j <= 20; j++)
    for (int i = 1; i <= 2 * n; i++) f[i][j] = f[f[i][j - 1]][j - 1];
  for (int i = 2 * n; i > n; i--) {
    int u = i;
    if (b[i] <= i + 1 - n) {
      ans++;
      continue;
    }
    for (int j = 20; j >= 0; j--)
      if (b[f[u][j]] > i + 1 - n) u = f[u][j], ans += (1 << j);
    ans += 2;
  }
  cout << ans << endl;
}
