#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e) {
  cout << e << '\n';
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << '\n';
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << '\n';
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << '\n';
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
ostream_iterator<int> screen(cout, " ");
const int sz = 2 * 1000 * 100 + 10, mod = 1000 * 1000 * 1000 + 7;
const int inf = INT_MAX >> 1;
const long long llinf = (1LL << 62);
const double pi = acos(-1.0);
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
vector<int> res;
long long powermod(long long n, long long p) {
  long long x = 1, y = n % mod;
  while (p) {
    if (p & 1LL) x = (y * x) % mod;
    y = (y * y) % mod;
    p = p >> 1LL;
  }
  return x;
}
int n, arr[1100], brr[1100];
int solve(int a, int factor) {
  int p = a, cnt = 0, total = 0;
  while (total < n) {
    if (arr[p] <= total and brr[p] == 0) {
      total++;
      brr[p] = 1;
    }
    p += factor;
    if ((p < 1 or p > n) and total != n) {
      factor *= -1;
      p += 2 * factor;
      cnt++;
    }
  }
  return cnt;
}
int main() {
  ios::sync_with_stdio(false);
  int mn;
  cin >> n;
  mn = n * n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  mn = min(mn, solve(1, 1));
  (memset(brr, 0, sizeof(brr)));
  mn = min(mn, solve(1, -1));
  cout << mn << endl;
  return 0;
}
