#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 2;
int dis[302][302], a[302];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if ((a[j] >= j - i && i < j) || (a[j] >= j + n - i && i > j))
        dis[i][j] = 1;
      else
        dis[i][j] = N;
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
  }
  int res = 0;
  for (int i = 1; i <= n; ++i) res += dis[i][(i + n - 2) % n + 1];
  cout << res << endl;
  return 0;
}
