#include <bits/stdc++.h>
using namespace std;
int n, a[500011], b[500011], m, st[21][500011], p[21][500011];
long long res;
int bmin(int u, int v) { return b[u] > b[v] ? v : u; }
int RMQ(int l, int r) {
  int k = 1, i = 0;
  for (; l + k + k <= r; k <<= 1, ++i)
    ;
  return bmin(st[i][l], st[i][r - k + 1]);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i < n; ++i) a[i + n] = a[i];
  m = n + n - 1;
  for (int i = 1; i <= m; ++i) b[i] = max(1, i - a[i]), st[0][i] = i;
  for (int i = 1, k = 1; k < m; ++i, k <<= 1)
    for (int j = 1; j + k + k <= m + 1; ++j)
      st[i][j] = bmin(st[i - 1][j], st[i - 1][j + k]);
  p[0][1] = 1;
  for (int i = 2; i <= m; ++i) p[0][i] = RMQ(b[i], i - 1);
  for (int i = 1; i <= 18; ++i)
    for (int j = 1; j <= m; ++j) p[i][j] = p[i - 1][p[i - 1][j]];
  for (int i = 1; i <= n; ++i) {
    if (b[i + n - 1] <= i) {
      ++res;
      continue;
    }
    for (int j = 18, k = i + n - 1; j >= 0; --j)
      b[p[j][k]] > i ? res += 1LL << j, k = p[j][k] : 0;
    res += 2;
  }
  cout << res << endl;
  return 0;
}
