#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int* a = new int[n];
  bool sb[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sb[i] = false;
  }
  int s = 0;
  int ans = -1;
  while (s < n) {
    ans++;
    for (int i = 0; i < n; i++) {
      if (!sb[i] && s >= a[i]) {
        s++;
        sb[i] = true;
      }
    }
    if (s < n) {
      ans++;
      for (int i = n - 1; i >= 0; i--) {
        if (!sb[i] && s >= a[i]) {
          s++;
          sb[i] = true;
        }
      }
    }
  }
  cout << ans;
}
