#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, count = 0, ans = 0;
  cin >> n;
  int vi[n];
  int a[n];
  memset(vi, 0, sizeof(vi));
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int flag = 0;
  while (count != n) {
    ans++;
    if (flag == 1) {
      for (i = n - 1; i >= 0; i--) {
        if (count >= a[i] && vi[i] == 0) {
          vi[i] = 1;
          count++;
        }
      }
      flag = 0;
    } else {
      for (i = 0; i < n; i++) {
        if (count >= a[i] && vi[i] == 0) {
          count++;
          vi[i] = 1;
        }
      }
      flag = 1;
    }
  }
  cout << (ans - 1) << endl;
  return 0;
}
