#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Max(T a, T b) {
  if (a > b)
    return a;
  else
    return b;
}
template <class T>
inline T Min(T a, T b) {
  if (a < b)
    return a;
  else
    return b;
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline T TripleMax(T a, T b, T c) {
  return Max(Max(a, b), c);
}
template <class T>
inline T TripleMin(T a, T b, T c) {
  return Min(Min(a, b), c);
}
const long double pi = M_PI;
const long double e = M_E;
const long double sqrt2 = M_SQRT2;
const long long llinfinity = 9223372036854775807;
const long long llminusinfinity = -9223372036854775808;
const int intinfinity = 2147483647;
const int intminusinfinity = -2147483648;
const int maxn = 1005;
int n;
int s1[maxn], s2[maxn];
int ret = 0;
int main(int argc, const char* argv[]) {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s1[i];
    s1[i + n] = s1[i];
  }
  for (int i = 0; i < n; i++) {
    s2[0] = 0;
    for (int j = 0; j < n - 1; j++) {
      s2[j + 1] = s2[j] + 1;
      for (int t = 2; t < s1[i + j + 1] + 1; t++) {
        if (j - t < -1) {
          break;
        }
        s2[j + 1] = Min(s2[j + 1], s2[j - t + 1] + 1);
      }
    }
    ret += s2[n - 1];
  }
  cout << ret << endl;
  return 0;
}
