#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 9;
int n, nxt[MAX], a[MAX];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  for (int l = 0; l < n; l++) {
    for (int i = n - 2, j = n - 1; i >= 0; i--) {
      while (i < j - a[j]) j--;
      nxt[i] = j;
    }
    for (int i = 0; i < n - 1; i = nxt[i]) ans++;
    rotate(a, a + n - 1, a + n);
  }
  cout << ans;
}
