#include <bits/stdc++.h>
using namespace std;
int arr[1050];
bool checked[1050];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    checked[i] = false;
  }
  int curr = 0;
  int ri = true;
  int ans = -1;
  while (curr != n) {
    ans++;
    if (ri) {
      for (int i = 0; i < n; ++i) {
        if (!checked[i] && curr >= arr[i]) {
          curr++;
          checked[i] = true;
        }
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (!checked[i] && curr >= arr[i]) {
          curr++;
          checked[i] = true;
        }
      }
    }
    ri = !ri;
  }
  cout << ans << endl;
  return 0;
}
