#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[501234];
int AA[501234];
int T[501234];
int P[501234];
void fnd(int i, int p) {
  if (A[i] >= p) return;
  fnd(P[i], p);
  A[i] = A[P[i]];
  T[i] += T[P[i]];
  P[i] = P[P[i]];
}
int brute() {
  int i, j, k, jj;
  for (i = (0); i < (n); ++i) A[i] = AA[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];
    }
  }
  return res;
}
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 = (0); i < (n); ++i) AA[i] = A[i];
    reverse(A, A + n);
    for (i = (n); i < (2 * n); ++i) A[i] = A[i - n];
    for (i = (0); i < (2 * n); ++i) T[i] = 1, A[i] += i;
    set<pair<int, int> > s;
    set<pair<int, int> >::iterator si;
    s.insert(make_pair(2 * n - 1, A[2 * n - 1]));
    for (i = (2 * n - 1) - 1; i >= (0); --i) {
      si = --s.lower_bound(make_pair(A[i], 1012345678));
      P[i] = si->first;
      for (; s.size() && s.begin()->second <= A[i]; s.erase(s.begin()))
        ;
      s.insert(make_pair(i, A[i]));
    }
    long long res = 0;
    for (i = (0); i < (n); ++i) {
      fnd(i, i + n - 1);
      res += T[i];
    }
    printf(
        "%"
        "I64d",
        (res));
    printf("\n"), firstout = 1;
  }
  return 0;
}
