#include <bits/stdc++.h>
using namespace std;
const int oo = 1 << 20;
const double PI = M_PI;
const double EPS = 1e-15;
int N;
long long a[303], dp[303], d[303];
int main() {
  cin.sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> d[i];
  long long ans = 0;
  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < N; ++i) a[i] = d[(k + i) % N];
    memset(dp, 127, sizeof(dp));
    dp[0] = 0;
    for (int i = 1; i < N; ++i) {
      long long b = oo;
      for (int j = i - 1; j >= i - a[i] && j >= 0; --j) b = min(b, dp[j]);
      dp[i] = b + 1;
    }
    ans += dp[N - 1];
  }
  cout << ans << endl;
  return 0;
}
