#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = 0;
  cin >> n;
  long long arr[n];
  vector<long long> temp(n + 1);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = n - 2, k = n - 1; j >= 0; j--) {
      while (j < k - arr[k]) k--;
      temp[j] = k;
    }
    rotate(arr, arr + n - 1, arr + n);
    long long x = 0;
    while (x < n - 1) {
      ans++;
      x = temp[x];
    }
  }
  cout << ans;
  return 0;
}
