#include <bits/stdc++.h>
using namespace std;
inline long long pow(long long a, long long b, long long mo) {
  if (!a) return 0;
  long long tmp = 1;
  for (; b; b >>= 1) {
    if (b & 1) tmp = (long long)tmp * a % mo;
    a = (long long)a * a % mo;
  }
  return tmp;
}
template <class T>
inline void R(T &xx) {
  xx = 0;
  char ch = getchar();
  bool F = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') F = 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    xx = xx + xx + (xx << 3) + ch - 48, ch = getchar();
  if (F) xx = -xx;
}
int n, a[500011], f[500011][22], d[500011][22];
long long ans;
inline int Min(int x, int y) { return x - a[x] < y - a[y] ? x : y; }
inline int ask(int x, int y) {
  if (x <= 0) return 0;
  int k = log2(y - x + 1.);
  return Min(f[x][k], f[y - (1 << k) + 1][k]);
}
int main() {
  R(n);
  for (int i = (1); i <= (n); i++) R(a[i]);
  for (int i = (1); i <= (n); i++) a[i + n] = a[i];
  n <<= 1;
  for (int i = (1); i <= (n); i++) f[i][0] = i;
  for (int i = (1); i <= (19); i++)
    for (int j = (1); j <= (n); j++) {
      if (j + (1 << i - 1) <= n)
        f[j][i] = Min(f[j][i - 1], f[j + (1 << i - 1)][i - 1]);
    }
  for (int i = (1); i <= (n); i++) d[i][0] = ask(i - a[i], i);
  for (int i = (1); i <= (19); i++)
    for (int j = (1); j <= (n); j++) d[j][i] = d[d[j][i - 1]][i - 1];
  for (int i = (n); i >= ((n >> 1) + 1); i--) {
    ans += 1 + (i - a[i] > i - (n >> 1) + 1);
    int k = i;
    for (int j = (19); j >= (0); j--)
      if (d[k][j] - a[d[k][j]] > i - (n >> 1) + 1) k = d[k][j], ans += 1 << j;
  }
  cout << ans << endl;
  return 0;
}
