#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int N = 25e4;
int n;
int32_t a[N], dp[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int64_t ans = 0;
  for (int i = 0; i < n; i++) {
    fill(dp, dp + n, 1e9);
    dp[(n - i) % n] = 0;
    for (int j = 1; j < n; j++) {
      int k = (n - i + j) % n;
      for (int kk = (k - min(a[k], j) + n) % n; kk != k; kk = (kk + 1) % n) {
        dp[k] = min(dp[k], dp[kk] + 1);
      }
    }
    ans += dp[(n - i + n - 1) % n];
  }
  cout << ans << endl;
  return 0;
}
