#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 555555;
int mn[MAX_N << 2];
int a[MAX_N], fa[MAX_N][18], p[MAX_N], n, N, L[MAX_N];
int query(int x, int l, int r, int f, int t) {
  if (f <= l && r <= t) {
    return mn[x];
  }
  int mid = (l + r) >> 1;
  int ret = 0;
  if (f <= mid) ret = query((x << 1), l, mid, f, t);
  if (t > mid) {
    int fk = query(((x << 1) + 1), mid + 1, r, f, t);
    if (L[ret] > L[fk]) ret = fk;
  }
  return ret;
}
void modify(int x, int l, int r, int v, int d) {
  if (l == r) {
    mn[x] = d;
    return;
  }
  int mid = (l + r) >> 1;
  if (v <= mid)
    modify((x << 1), l, mid, v, d);
  else
    modify(((x << 1) + 1), mid + 1, r, v, d);
  if (L[mn[(x << 1)]] > L[mn[((x << 1) + 1)]])
    mn[x] = mn[((x << 1) + 1)];
  else
    mn[x] = mn[(x << 1)];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  N = n + n - 1;
  for (int i = n + 1; i <= N; ++i) a[i] = a[i - n];
  L[0] = N + 1;
  for (int i = 1; i <= N; ++i) {
    L[i] = max(i - a[i], 1);
  }
  for (int i = 1; i <= N; ++i) {
    p[i] = query(1, 1, N, L[i], i);
    if (i == 1) p[i] = 0;
    fa[i][0] = p[i];
    modify(1, 1, N, i, i);
  }
  L[0] = 0;
  for (int k = 1; k <= 17; ++k)
    for (int i = 1; i <= N; ++i) fa[i][k] = fa[fa[i][k - 1]][k - 1];
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    int u = i + n - 1, v = i;
    ans++;
    if (L[u] <= v) {
      continue;
    }
    for (int k = 17; k >= 0; --k)
      if (L[fa[u][k]] > v) u = fa[u][k], ans += (1 << k);
    u = fa[u][0];
    ans++;
  }
  cout << ans << endl;
}
