#include <bits/stdc++.h>
int a[20005], n, f[20005];
int Max(int a, int b) { return a > b ? a : b; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + (n - i - 1));
    a[n - i - 1 + n] = a[n - i - 1];
  }
  memset(f, 0, sizeof f);
  int ans = 0;
  for (int v = n; v; v--) {
    for (int i = 0; i < n; i++) f[i + v] = Max(f[i + v - 1] - 1, a[i + v]);
    for (int i = v; i < n + v - 1; i = i + f[i]) ans++;
  }
  printf("%d\n", ans);
}
