#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5143;
const long long Linf = 1e18 + 5413;
const double eps = 1e-10;
const double pi = acos(-1);
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline T lcm(T a, T b) {
  return a / __gcd(a, b) * b;
}
inline int read() {
  int res = 0LL;
  int neg;
  while (1) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9' || ch == '-') {
      if (ch == '-')
        neg = -1;
      else
        neg = 1, res = ch - '0';
      break;
    }
  }
  while (1) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9')
      res *= 10, res += ch - '0';
    else
      break;
  }
  return res * neg;
}
const int N = 371717;
int a[N];
int order[N];
int dp[N];
int kd[N * 5];
void put(int k, int b, int e, int x, int val) {
  if (b > x || e < x) return;
  if (b == e) {
    kd[k] = val;
    return;
  }
  put(k + k, b, (b + e) / 2, x, val);
  put(k + k + 1, (b + e) / 2 + 1, e, x, val);
  kd[k] = min(kd[k + k], kd[k + k + 1]);
}
int get(int k, int b, int e, int x1, int x2) {
  if (b > x2 || e < x1) return inf;
  if (b >= x1 && e <= x2) return kd[k];
  int ll = get(k + k, b, (b + e) / 2, x1, x2);
  int rr = get(k + k + 1, (b + e) / 2 + 1, e, x1, x2);
  return min(ll, rr);
}
int main() {
  int n = read();
  for (int(i) = (1); (i) <= (n); (i)++) a[i] = read();
  for (int(i) = (1); (i) <= (n); (i)++) order[i] = i;
  long long res = 0;
  put(1, 1, n, 1, 0);
  for (int(itr) = (1); (itr) <= (n); (itr)++) {
    for (int(i) = (2); (i) <= (n); (i)++) {
      put(1, 1, n, i, get(1, 1, n, max(1, i - a[order[i]]), i - 1) + 1);
    }
    res += get(1, 1, n, n, n);
    int temp = order[n];
    for (int(i) = (n - 1); (i) >= (1); (i)--) order[i + 1] = order[i];
    order[1] = temp;
  }
  cout << res << endl;
  return 0;
}
