#include <bits/stdc++.h>
int main() {
  int c, i, a[1000], t = 0, count = 0, k;
  scanf("%d", &c);
  for (i = 0; i < c; i++) {
    scanf("%d", &a[i]);
  }
  k = c;
  while (k > 0) {
    count = count + 1;
    for (i = 0; i < c; i++) {
      if (a[i] <= t) {
        t = t + 1;
        k = k - 1;
        a[i] = c + 1000;
      }
    }
    if (k > 0) {
      count = count + 1;
      for (i = c - 1; i > -1; i--) {
        if (a[i] <= t) {
          t = t + 1;
          k = k - 1;
          a[i] = c + 1000;
        }
      }
    }
  }
  printf("%d", count - 1);
  return 0;
}
