#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  scanf("%d", &n);
  int arr[n];
  int i;
  for (i = 0; i < n; i++) scanf("%d", &arr[i]);
  bool done[n];
  for (i = 0; i < n; i++) done[i] = false;
  int direction = 1;
  int direcChange = -1;
  int collected = 0;
  while (collected != n) {
    direcChange++;
    if (direction == 1) {
      for (i = 0; i < n; i++) {
        if (!done[i] && collected >= arr[i]) {
          done[i] = true;
          collected++;
        }
      }
      direction = -1;
    } else if (direction == -1) {
      for (i = n - 1; i >= 0; i--) {
        if (!done[i] && collected >= arr[i]) {
          done[i] = true;
          collected++;
        }
      }
      direction = 1;
    }
  }
  printf("%d", direcChange);
  return 0;
}
