#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 20000;
int n, a[MAXN];
int solve(int v, int u) {
  int cur = 0, end0 = u, end1 = u;
  for (int i = u; i >= v; i--)
    if (end0 <= i)
      end1 = min(end1, i - a[i]);
    else {
      cur++;
      end0 = end1;
      end1 = i - a[i];
    }
  return cur;
}
int main() {
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  int ans = 0;
  for (int i = n; i >= 1; i--) ans += solve(i, i + n - 1);
  cout << ans << endl;
  return 0;
}
