#include <bits/stdc++.h>
using namespace std;
int n;
int a[1 << 10];
int dp[1 << 10];
void read() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
}
void solve() {
  for (int i = n; i < 2 * n; i++) a[i] = a[i - n];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    memset(dp, 0, sizeof(dp));
    for (int j = i + 1; j < i + n; j++) {
      int mn = n;
      for (int k = j - 1; k >= i && k >= j - a[j]; k--) mn = min(mn, dp[k] + 1);
      dp[j] = mn;
    }
    ans += dp[i + n - 1];
  }
  cout << ans << endl;
}
int main() {
  read();
  solve();
  return 0;
}
