#include <bits/stdc++.h>
using namespace std;
int n, a[1024];
bool f[1024] = {false};
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int pos = 0, info = 0, turn = 0;
  while (1) {
    for (; pos < n; pos++) {
      if (a[pos] <= info && f[pos] == false) {
        info++;
        f[pos] = true;
      }
    }
    if (info >= n) break;
    turn++;
    pos--;
    for (; pos >= 0; pos--) {
      if (a[pos] <= info && f[pos] == false) {
        info++;
        f[pos] = true;
      }
    }
    if (info >= n) break;
    turn++;
    pos++;
  }
  cout << turn << endl;
  return 0;
}
