#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int dir = 1;
  int dirchange = 0;
  int collected = 0;
  scanf("%d", &n);
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  int lastIndex = -1;
  int currIndex = 0;
  while (collected < n) {
    if (dir == 1) {
      for (int i = lastIndex + 1; i < n; i++) {
        if (i >= n) break;
        if (A[i] <= collected) {
          if (dir != 1) dirchange++;
          dir = 1;
          collected++;
          A[i] = 1001;
          currIndex = i;
        }
      }
      for (int i = lastIndex - 1; i >= 0; i--) {
        if (i < 0) break;
        if (A[i] <= collected) {
          if (dir != 0) dirchange++;
          dir = 0;
          collected++;
          A[i] = 1001;
          currIndex = i;
        }
      }
    } else {
      for (int i = lastIndex - 1; i >= 0; i--) {
        if (i < 0) break;
        if (A[i] <= collected) {
          if (dir != 0) dirchange++;
          dir = 0;
          collected++;
          A[i] = 1001;
          currIndex = i;
        }
      }
      for (int i = lastIndex + 1; i < n; i++) {
        if (i >= n) break;
        if (A[i] <= collected) {
          if (dir != 1) dirchange++;
          dir = 1;
          collected++;
          A[i] = 1001;
          currIndex = i;
        }
      }
    }
    lastIndex = currIndex;
  }
  printf("%d\n", dirchange);
  return 0;
}
