#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
int n;
int a[MAX_N];
int ispicked[MAX_N];
void solve() {
  int ans = 0;
  int powers = 0;
  while (true) {
    for (int i = 0; i < n; i++) {
      if (a[i] <= powers && !ispicked[i]) {
        ispicked[i] = true;
        powers++;
      }
    }
    if (powers == n) break;
    ans++;
    for (int j = n - 1; j >= 0; j--) {
      if (a[j] <= powers && !ispicked[j]) {
        ispicked[j] = true;
        powers++;
      }
    }
    if (powers == n) break;
    ans++;
  }
  printf("%d\n", ans);
}
int main(int argc, char const *argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  solve();
  return 0;
}
