#include <bits/stdc++.h>
using namespace std;
int a[20002], b[10001], c[10001];
int main() {
  int n, k, sum = 0, nex;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    bool Ok = 0;
    for (int j = i - 1; j > 0; j--)
      if (i >= n + j - a[j]) {
        Ok = 1;
        c[i] = j;
        break;
      }
    if (!Ok)
      for (int j = n; j > i; j--)
        if (i >= j - a[j]) {
          c[i] = j;
          break;
        }
  }
  for (int i = 1; i <= n; i++) b[i] = i;
  int cur;
  for (int i = 1; i <= n; i++) {
    cur = 1;
    while (1) {
      nex = c[b[cur]] + i - 1;
      if (nex > n) nex -= n;
      if (nex > cur) {
        cur = nex;
        ++sum;
      } else {
        for (int j = n; j > cur; j--)
          if (cur >= j - a[b[j]]) {
            cur = j;
            ++sum;
            break;
          }
      }
      if (cur == n) break;
    }
    for (int j = 1; j <= n; j++) {
      --b[j];
      if (b[j] == 0) b[j] = n;
    }
  }
  cout << sum;
}
