#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  std::vector<int> X(n);
  for (int i = 0; i < n; ++i) scanf("%d", &X[i]);
  int count = 0, collected = 0;
  while (collected < n) {
    for (std::vector<int>::iterator it = X.begin(); it != X.end(); ++it) {
      if (*it == -100)
        continue;
      else if (*it <= collected) {
        *it = -100;
        collected++;
      }
    }
    if (collected == n) break;
    count++;
    for (std::vector<int>::reverse_iterator it = X.rbegin(); it != X.rend();
         ++it) {
      if (*it == -100)
        continue;
      else if (*it <= collected) {
        *it = -100;
        collected++;
      }
    }
    if (collected == n) break;
    count++;
  }
  printf("%d\n", count);
  return 0;
}
