#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  long long ans = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int ti = 0; ti < n; ti++) {
    int i = (n - ti) % n;
    vector<int> c(n, 1000000000);
    c[i] = 0;
    for (int j = i; j <= n + i - 1; j++) {
      for (int k = i; k < j; k++) {
        int pos = j % n;
        int pos1 = k % n;
        if ((pos - pos1 + n) % n <= a[pos]) c[pos] = min(c[pos1] + 1, c[pos]);
      }
    }
    ans += c[(i - 1 + n) % n];
  }
  cout << ans;
  return 0;
}
