#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
T &minn(T &a, T b) {
  if (b < a) a = b;
  return a;
}
template <class T>
T &maxx(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int &madd(int &a, int b) {
  a += b;
  if (a >= 1000000009) a -= 1000000009;
  return a;
}
int &msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000009;
  return a;
}
int &mmult(int &a, int b) { return a = (long long)a * b % 1000000009; }
int mdiv(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
int n, m;
int A[20123];
int main() {
  int i, j, k, jj;
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "d",
                     &(n)) > 0;
       ++ts) {
    for (i = (0); i < (n); ++i)
      scanf(
          "%"
          "d",
          &(A[i]));
    for (i = (n); i < (2 * n); ++i) A[i] = A[i - n];
    int res = 0;
    for (i = (n); i < (2 * n); ++i) {
      j = jj = i;
      for (k = (i + 1) - 1; k >= (i + 1 - n); --k) {
        if (k < j) j = jj, ++res;
        if (jj > k - A[k]) jj = k - A[k];
      }
    }
    printf(
        "%"
        "d",
        (res));
    printf("\n"), firstout = 1;
  }
  return 0;
}
