#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[1001];
  bool visited[1001];
  memset(visited, false, sizeof(visited));
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int cnt = 0;
  int marked = 0;
  int dir = 1;
  int c = 0;
  while (1) {
    if (marked == n) break;
    if (dir == 1) {
      for (int i = 1; i <= n; i++) {
        if (visited[i] == false && arr[i] <= marked) {
          visited[i] = true;
          marked += 1;
        }
      }
      cnt++;
      dir = -1;
    } else if (dir == -1) {
      for (int i = n; i >= 1; i--) {
        if (visited[i] == false && arr[i] <= marked) {
          visited[i] = true;
          marked += 1;
        }
      }
      cnt++;
      dir = 1;
    }
  }
  cout << cnt - 1 << endl;
  return 0;
}
