#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7 + 7;
const int MOD = 998244353;
const int N = 6e5 + 10;
int n;
int a[N];
map<int, int> dp;
int cnt = N / 2;
long long ans;
void solve() {
  cin >> n;
  for (int i = cnt; i < cnt + n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = cnt + 1; j < cnt + n; j++) {
      dp[j] = N;
      for (int k = max(j - a[j], cnt); k < j; k++)
        dp[j] = min(dp[j], dp[k] + 1);
    }
    cnt--;
    ans += dp[cnt + n];
    a[cnt] = a[cnt + n];
    dp.clear();
  }
  cout << ans;
}
int main() {
  int TE = 1;
  while (TE--) {
    solve();
  }
  return 0;
}
