#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a[1009], d[1009], x, dau, vt, vttam, kq;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    d[i] = 1;
  }
  vt = 1;
  dau = 1;
  x = 0;
  kq = 0;
  while (x < n) {
    if (x > 0) kq++;
    if (dau == 1) {
      for (i = vt; i <= n; i++)
        if (d[i] == 1 && a[i] <= x) {
          x++;
          d[i] = 0;
          vttam = i;
        }
    } else {
      for (i = vt; i >= 1; i--)
        if (d[i] == 1 && a[i] <= x) {
          x++;
          d[i] = 0;
          vttam = i;
        }
    }
    vt = vttam;
    dau = -dau;
  }
  cout << kq;
}
