#include <bits/stdc++.h>
using namespace std;
int n, a[1005];
bool t[1005];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  memset(t, 0, sizeof(t));
  int count = 0;
  int taken = 0;
  bool right = true;
  while (1) {
    if (right) {
      for (int i = 0; i < n; i++) {
        if (taken >= a[i] && !t[i]) {
          t[i] = true;
          taken++;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (taken >= a[i] && !t[i]) {
          t[i] = true;
          taken++;
        }
      }
    }
    if (taken == n) break;
    count++;
    right = !right;
  }
  printf("%d\n", count);
  return 0;
}
