#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500050;
const int INF = 0x3f3f3f3f;
namespace SegmentTree {
const int MAXD = MAXN * 5;
int minv[MAXD], minp[MAXD];
inline void updata(int u) {
  if (minv[u << 1] < minv[(u << 1) + 1])
    minp[u] = minp[u << 1];
  else
    minp[u] = minp[(u << 1) + 1];
  minv[u] = min(minv[u << 1], minv[(u << 1) + 1]);
}
int* src;
void build(int u, int l, int r) {
  if (l == r) {
    minv[u] = src[l];
    minp[u] = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(u << 1, l, mid);
  build((u << 1) + 1, mid + 1, r);
  updata(u);
}
int ql, qr;
pair<int, int> query(int u, int l, int r) {
  if (l > qr || r < ql) return make_pair(INF, 0);
  if (ql <= l && r <= qr) return make_pair(minv[u], minp[u]);
  int mid = (l + r) >> 1;
  return min(query(u << 1, l, mid), query((u << 1) + 1, mid + 1, r));
}
}  // namespace SegmentTree
const int MAXLOG = 20;
int A[MAXN], val[MAXN];
int pre[MAXN][MAXLOG];
long long dist[MAXN][MAXLOG];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
    val[i] = max(i - A[i], 1);
    val[N + i] = max(N + i - A[i], 1);
  }
  SegmentTree::src = val;
  SegmentTree::build(1, 1, N * 2);
  for (int i = 1; i <= N; i++) {
    SegmentTree::ql = N + i - A[i];
    SegmentTree::qr = N + i - 1;
    pair<int, int> res = SegmentTree::query(1, 1, N * 2);
    pre[i][0] = (res.second - 1) % N + 1;
    dist[i][0] = N + i - res.second;
  }
  for (int lvl = 1; lvl < MAXLOG; lvl++)
    for (int i = 1; i <= N; i++) {
      pre[i][lvl] = pre[pre[i][lvl - 1]][lvl - 1];
      dist[i][lvl] = dist[i][lvl - 1] + dist[pre[i][lvl - 1]][lvl - 1];
    }
  long long ans = 0;
  for (int p = 1; p <= N; p++) {
    int cur = p, res = N - 1;
    for (int i = MAXLOG - 1; i >= 0; i--)
      if (dist[cur][i] + A[pre[cur][i]] <= res) {
        res -= dist[cur][i], ans += 1 << i;
        cur = pre[cur][i];
      }
    if (!res)
      ;
    if (A[cur] >= res)
      ans += 1;
    else {
      for (int i = 0; i < MAXLOG; i++)
        if (dist[cur][i] + A[pre[cur][i]] >= res) {
          ans += 1 << i;
          break;
        }
      ans++;
    }
  }
  cout << ans << endl;
}
