#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
const long double E = 1e-9;
unsigned char ccc;
bool _minus = false;
template <typename T>
inline T sqr(T t) {
  return (t * t);
}
inline void read(long long &n) {
  n = 0;
  _minus = false;
  while (true) {
    ccc = getchar();
    if (ccc == ' ' || ccc == '\n') break;
    if (ccc == '-') {
      _minus = true;
      continue;
    }
    n = n * 10 + ccc - '0';
  }
  if (_minus) n *= -1;
}
inline void read(int &n) {
  n = 0;
  _minus = false;
  while (true) {
    ccc = getchar();
    if (ccc == ' ' || ccc == '\n') break;
    if (ccc == '-') {
      _minus = true;
      continue;
    }
    n = n * 10 + ccc - '0';
  }
  if (_minus) n *= -1;
}
char wwww[19];
int kkkk;
inline void write(long long y) {
  long long x = y;
  kkkk = 0;
  if (x < 0) {
    putchar('-');
    x *= -1;
  }
  if (!x)
    ++kkkk, wwww[kkkk] = '0';
  else
    while (x) {
      ++kkkk;
      wwww[kkkk] = char(x % 10 + '0');
      x /= 10;
    }
  for (int i = kkkk; i >= 1; --i) putchar(wwww[i]);
}
vector<int> v;
const int MAX_SIZE = 5e5;
const int MAX_LOG = 20;
int t[MAX_LOG][MAX_SIZE * 4];
vector<int> vec;
int n;
void build(int ind, int v, int l, int r) {
  if (l == r) {
    t[ind][v] = vec[l];
    return;
  }
  int x = (l + r) >> 1;
  build(ind, v << 1, l, x);
  build(ind, v << 1 | 1, x + 1, r);
  t[ind][v] = max(t[ind][v << 1], t[ind][v << 1 | 1]);
}
int get(int ind, int v, int tl, int tr, int l, int r) {
  if (l <= tl && tr <= r) {
    return t[ind][v];
  }
  if (tr < l || r < tl) return INT_MIN;
  int x = (tl + tr) >> 1;
  return max(get(ind, v << 1, tl, x, l, r),
             get(ind, v << 1 | 1, x + 1, tr, l, r));
}
inline int get(int ind, int l, int r) { return get(ind, 1, 0, n - 1, l, r); }
inline void build(int ind) { build(ind, 1, 0, n - 1); }
inline int solve(int l, int r) {
  int ans = INT_MAX;
  int res = 0;
  for (int i = MAX_LOG - 1, pos = l; i >= 0; i--) {
    int tipa_next = get(i, l, pos);
    if (tipa_next >= r) {
      ans = min(ans, res + (1 << i));
    } else {
      res += (1 << i);
      pos = tipa_next;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  srand(time(NULL));
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  ::n = n + n;
  reverse(v.begin(), v.end());
  v.insert(v.end(), v.begin(), v.end());
  for (int i = 0; i < n + n; i++) v[i] = v[i] + i;
  vec.insert(vec.end(), v.begin(), v.end());
  build(0);
  for (int i = 1; i < MAX_LOG; i++) {
    for (int j = 0; j < ::n; j++) {
      int l = j, r = min(::n - 1, get(i - 1, j, j));
      vec[j] = get(i - 1, l, r);
    }
    build(i);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += solve(i, i + n - 1);
  }
  cout << ans << "\n";
}
