#include <bits/stdc++.h>
using namespace std;
template <class T>
void input(T &x) {
  char c = getchar();
  x = 0;
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
}
inline long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
const int N = 10005;
int dp[N];
int n;
int a[N];
int main() {
  input(n);
  for (int i = 0; i < n; i++) input(a[i]);
  long long ans = 0;
  for (int round = 0; round < n; round++) {
    int f = (n - round) % n;
    vector<pair<int, int> > v;
    v.push_back(make_pair(0, 0));
    for (int j = 1; j < n; j++) {
      int now = (f + j) % n;
      int range = a[now];
      int iMin = 1e8;
      for (int k = v.size() - 1; k >= 0; k--) {
        int pos = v[k].second;
        if (j - range <= pos)
          iMin = min(iMin, 1 + v[k].first);
        else
          break;
      }
      while (v.size() && v.back().first >= iMin) v.pop_back();
      v.push_back(make_pair(iMin, j));
    }
    ans += v.back().first;
  }
  cout << ans << endl;
  return 0;
}
