#include <bits/stdc++.h>
using namespace std;
const unsigned _mod = 998244353;
const unsigned mod = 1e9 + 7;
const long long infi = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
long long ksm(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % mod;
    y >>= 1ll;
    x = x * x % mod;
  }
  return ret;
}
long long qpow(long long x, long long y, long long m) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % m;
    y >>= 1ll;
    x = x * x % m;
  }
  return ret;
}
long long _gcd(long long x, long long y) { return y ? _gcd(y, x % y) : x; }
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, k, g, ans, a[500010], b[500010], m[500010], fa[500010][25];
int main() {
  cin >> n;
  for (register int i = n; i >= 1; --i) a[i] = read(), a[n + i] = a[i];
  for (register int i = 1; i <= n << 1; ++i) {
    a[i] = i + a[i];
    if (a[i] > (n << 1)) a[i] = n << 1;
  }
  for (register int i = n << 1; i >= 1; --i) {
    for (int j = a[i]; j; j -= j & -j)
      if (a[m[j]] > a[b[i]]) b[i] = m[j];
    for (int j = i; j <= n + n; j += j & -j)
      if (a[i] > a[m[j]]) m[j] = i;
    if (!b[i]) b[i] = i;
  }
  for (register int i = n << 1; i >= 1; --i) {
    fa[i][0] = b[i];
    for (register int j = 0; j <= 20; ++j) fa[i][j + 1] = fa[fa[i][j]][j];
  }
  for (register int i = 1; i <= n; ++i) {
    g = i + n - 1;
    k = i;
    for (register int j = 20; j >= 0; --j)
      if (a[fa[k][j]] < g) k = fa[k][j], ans += 1 << j;
    ans++;
    if (a[k] < g) ++ans;
  }
  cout << ans << '\n';
  return 0;
}
