#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000 + 1;
int A[MAX_N];
bool V[MAX_N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", A + i);
  }
  int cnt = 0, ans = -1, collected = 0, now = 0;
  bool direction = true;
  while (cnt < n) {
    ans++;
    if (direction) {
      for (now = 0; now < n; ++now) {
        if (collected >= A[now] && !V[now]) {
          collected++;
          V[now] = true;
          cnt++;
        }
      }
      direction = false;
    } else {
      for (now = n - 1; now >= 0; --now) {
        if (collected >= A[now] && !V[now]) {
          collected++;
          V[now] = true;
          cnt++;
        }
      }
      direction = true;
    }
  }
  printf("%d\n", ans);
  return 0;
}
