#include <bits/stdc++.h>
int arr[1001];
bool u[1001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
  }
  int sm = 0;
  int res = 0;
  while (true) {
    for (int i = 0; i < n; i++) {
      if (!u[i] && arr[i] <= sm) {
        sm++;
        u[i] = true;
      }
    }
    if (sm == n) {
      break;
    }
    res++;
    for (int i = n - 1; i >= 0; i--) {
      if (!u[i] && arr[i] <= sm) {
        sm++;
        u[i] = true;
      }
    }
    if (sm == n) {
      break;
    }
    res++;
  }
  printf("%d", res);
}
