#include <bits/stdc++.h>
using namespace std;
const int MAXN = 250010;
int n, a[MAXN], id[MAXN], dp[MAXN];
void shift() {
  int tem = id[n - 1];
  for (int i = n - 1; i > 0; --i) id[i] = id[i - 1];
  id[0] = tem;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i], id[i] = i;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    dp[0] = 0;
    for (int j = 1; j < n; ++j) {
      dp[j] = ~0U >> 1;
      for (int k = 1; k <= a[id[j]] && j - k >= 0; ++k)
        dp[j] = min(dp[j], dp[j - k] + 1);
    }
    ans += dp[n - 1];
    shift();
  }
  cout << ans << endl;
  return 0;
}
