#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
const double PI = acos((double)-1);
int ts, ts2, ts3, ts4;
int n, m;
long long gcd(long long x, long long y) {
  long long t;
  for (; y != 0;) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}
int a[500005], daburu[500005][20], minpos[500005][20], q2[35];
long long alla;
double sqr(double x) { return x * x; }
template <class T>
void mn(T& x, T y) {
  x = min(x, y);
}
template <class T>
void mx(T& x, T y) {
  x = max(x, y);
}
int lg[500005];
int getMin(int x, int y) {
  int t1 = lg[y - x + 1], t2, t3;
  t2 = minpos[x][t1], t3 = minpos[y - q2[t1] + 1][t1];
  if (t2 - a[t2] < t3 - a[t3])
    return t2;
  else
    return t3;
}
void getMinJump() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  for (i = 1; i <= 19; i++)
    for (j = 1; j <= 2 * n; j++) {
      if (2 * n - q2[i] >= j) {
        t1 = j, t2 = i - 1;
        t3 = j + q2[i - 1];
        t4 = i - 1;
        t5 = minpos[t1][t2], t6 = minpos[t3][t4];
        if (t5 - a[t5] < t6 - a[t6])
          minpos[j][i] = t5;
        else
          minpos[j][i] = t6;
      }
    }
  for (i = 1; i <= 2 * n; i++) lg[i] = (int)log2(i);
}
void getAns() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  for (i = n + 1; i <= 2 * n; i++) {
    if (i - a[i] <= i - n + 1) {
      alla++;
      continue;
    }
    int nw = i;
    for (j = 20; j >= 0;) {
      j--;
      if (j < 0) break;
      if (daburu[nw][j] - a[daburu[nw][j]] > i - n + 1)
        nw = daburu[nw][j], alla += q2[j];
    }
    alla++;
    alla++;
  }
}
int b[500005];
int main() {
  int i, j, k, l, t1, t2, t3, t4, t5, t6, t7, t8, t9, t, nw;
  int tt1, tt2, tt3, tt4;
  double u1, u2, u3, u4, u5, u6, u7, u8, u9;
  char c1, c2, c3;
  srand((unsigned)time(0));
  for (q2[0] = 1, i = 1; i < 35; q2[i] = q2[i - 1] * 2, i++)
    ;
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%daburu", &a[i]), a[n + i] = a[i];
  for (i = 1; i <= 2 * n; i++) b[i] = i - a[i];
  for (i = 1; i <= 2 * n; i++) minpos[i][0] = i;
  getMinJump();
  for (i = 1; i <= 2 * n; i++) {
    if (i - a[i] <= 0)
      daburu[i][0] = 0;
    else
      daburu[i][0] = getMin(i - a[i], i - 1);
  }
  for (i = 1; i <= 19; i++)
    for (j = 1; j <= 2 * n; j++) {
      t1 = daburu[j][i - 1];
      daburu[j][i] = daburu[t1][i - 1];
      if (daburu[j][i] == 0) ts = 0;
    }
  getAns();
  cout << alla << endl;
  return 0;
}
