#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[500005], b[500005], reach[500005][18], store[500005][18], cnt[18];
void update(int i, int layer) {
  while (cnt[layer] > 0 &&
         reach[store[cnt[layer] - 1][layer]][layer] >= reach[i][layer])
    cnt[layer]--;
  store[cnt[layer]][layer] = i;
  cnt[layer]++;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i + n] = a[i];
  }
  m = 2 * n - 1;
  for (int i = 1; i <= m; i++) {
    b[i] = i - a[i];
    reach[i][0] = max(1, b[i]);
  }
  long long ret = 0;
  for (int i = 1; i <= m; i++) {
    update(i, 0);
    for (int j = 1; j < 18; j++) {
      int low = 0, high = cnt[j - 1] - 1, ans = -1;
      while (low <= high) {
        int mid = (low + high) / 2;
        if (store[mid][j - 1] >= reach[i][j - 1]) {
          ans = mid;
          high = mid - 1;
        } else
          low = mid + 1;
      }
      reach[i][j] = reach[store[ans][j - 1]][j - 1];
      update(i, j);
    }
    if (i < n) continue;
    int moves = 0, prev = i;
    for (int j = 18 - 1; j >= 0; j--) {
      int low = 0, high = cnt[j] - 1, ans = -1;
      while (low <= high) {
        int mid = (low + high) / 2;
        if (store[mid][j] >= prev) {
          ans = mid;
          high = mid - 1;
        } else
          low = mid + 1;
      }
      if (reach[store[ans][j]][j] > i - n + 1) {
        moves += 1 << j;
        prev = reach[store[ans][j]][j];
      }
    }
    moves++;
    ret += moves;
  }
  cout << ret << endl;
}
