#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[1005];
  int visited[1005];
  for (int i = 1; i <= 1002; i++) {
    visited[i] = 0;
  }
  int cnt, i, j, d, n, c, ans, f;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  cnt = 0;
  f = 0;
  ans = 0;
  while (cnt != n) {
    for (i = 1; i <= n; i++) {
      if (visited[i] == 0 && arr[i] <= f) {
        visited[i] = 1;
        cnt++;
        f++;
      }
    }
    i = 1;
    if (cnt != n) {
      ans++;
    }
    for (j = n; j > 0; j--) {
      if (visited[j] == 0 && arr[j] <= f) {
        visited[j] = 1;
        cnt++;
        f++;
      }
    }
    if (cnt != n) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
