#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, num[1010], var[1010];
  scanf("%I64d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &num[i]);
  }
  long long int loc, sum, s, q, temp = 0;
  loc = 0;
  sum = 0;
  s = 0;
  q = 1;
  while (sum != n) {
    if (q == 1) {
      for (int i = loc; i < n; i++) {
        if (num[i] <= sum && num[i] >= 0) {
          num[i] = -1;
          temp = i;
          sum++;
        }
      }
      loc = temp - 1;
      q = 0;
    } else {
      for (int i = loc; i >= 0; i--) {
        if (num[i] <= sum && num[i] >= 0) {
          num[i] = -1;
          temp = i;
          sum++;
        }
      }
      loc = temp + 1;
      q = 1;
    }
    var[s] = q;
    s++;
  }
  long long int re = 0;
  for (int i = 1; i < s; i++) {
    if (var[i - 1] != var[i]) re++;
  }
  printf("%I64d\n", re);
  return 0;
}
