#include <bits/stdc++.h>
using namespace std;
void boost() { ios_base::sync_with_stdio(0); }
int n, s, ans;
int x[1001];
int main() {
  boost();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  while (s != n) {
    if (ans % 2 == 0) {
      for (int i = 0; i < n; i++) {
        if (s >= x[i] && x[i] != -1) {
          s++;
          x[i] = -1;
        }
      }
      if (s == n) {
        break;
      }
    } else {
      for (int i = n - 1; i >= 0; i--) {
        if (s >= x[i] && x[i] != -1) {
          s++;
          x[i] = -1;
        }
      }
      if (s == n) {
        break;
      }
    }
    ans++;
  }
  cout << ans;
  exit(0);
}
