#include <bits/stdc++.h>
using namespace std;
struct tree {
  tree* left;
  tree* right;
  long long value;
  long long min, max;
  long long index;
};
tree* rad;
vector<long long> v;
vector<tree> p;
int N;
long long sum = 0;
long long maxim = 0;
long long index2 = 0;
void add(tree* t) {
  tree* l = new tree;
  l->value = 0;
  l->index = 0;
  l->min = t->min;
  l->max = t->min + (t->max - t->min) / 2;
  l->left = nullptr;
  l->right = nullptr;
  tree* r = new tree;
  r->value = 0;
  r->index = 0;
  r->min = t->min + (t->max - t->min) / 2 + 1;
  r->max = t->max;
  r->left = nullptr;
  r->right = nullptr;
  t->left = l;
  t->right = r;
  if (l->min < l->max) add(t->left);
  if (r->min < r->max) add(t->right);
  if (l->min == l->max) {
    l->value = v[l->max] + 2 * N - l->max - 1;
    l->index = l->max;
  } else {
    l->value = max(l->left->value, l->right->value);
    if (l->left->value > l->right->value) {
      l->index = l->left->index;
    } else {
      l->index = l->right->index;
    }
  }
  if (r->min == r->max) {
    r->value = v[r->max] + 2 * N - r->max - 1;
    r->index = r->max;
  } else {
    r->value = max(r->left->value, r->right->value);
    if (r->left->value > r->right->value) {
      r->index = r->left->index;
    } else {
      r->index = r->right->index;
    }
  }
}
void query(long long x, long long y, tree* p) {
  if (p->min == x && p->max == y) {
    if (maxim < p->value) {
      maxim = p->value;
      index2 = p->index;
    }
    return;
  }
  if (x <= p->min + (p->max - p->min) / 2) {
    query(x, min(p->min + (p->max - p->min) / 2, y), p->left);
  }
  if (y >= p->min + (p->max - p->min) / 2 + 1) {
    query(max(p->min + (p->max - p->min) / 2 + 1, x), y, p->right);
  }
}
int main(int argc, const char* argv[]) {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    v.push_back(min(x, N - 1));
  }
  for (int i = 0; i < N; ++i) {
    v.push_back(v[i]);
  }
  tree* r = new tree;
  r->value = 0;
  r->min = 0;
  r->max = 2 * N - 1;
  r->left = nullptr;
  r->right = nullptr;
  add(r);
  r->value = max(r->left->value, r->right->value);
  if (r->left->value > r->right->value) {
    r->index = r->left->index;
  } else {
    r->index = r->right->index;
  }
  for (int n = 0; n < N; ++n) {
    long long begin = 2 * N - n - 1;
    long long end = N - n;
    int partial = 0;
    while (begin > end) {
      maxim = 0;
      index2 = 0;
      if (v[begin] >= begin - end) {
        begin = end;
      } else {
        query(max(begin - v[begin], end), begin - 1, r);
        begin = index2;
      }
      sum++;
      partial++;
    }
  }
  cout << sum;
  return 0;
}
