#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int c = 0, x = 0, l = 0, k = 0, t = 0;
  int b[n];
  int i = 0;
  while (i < n) {
    b[i] = 0;
    i++;
  }
  while (1) {
    for (i = 0; i < n; i++) {
      if (a[i] <= x && b[i] != 1) {
        b[i] = 1;
        k++;
        l++;
        x = k;
      }
    }
    if (l == n) {
      break;
    } else
      t++;
    for (int j = n - 1; j >= 0; j--) {
      if (a[j] <= x && b[j] != 1) {
        b[j] = 1;
        k++;
        l++;
        x = k;
      }
    }
    if (l == n) {
      break;
    } else
      t++;
  }
  cout << t << endl;
}
