#include <bits/stdc++.h>
using namespace std;
long long a[1010];
bool v[2000];
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int gy = 0;
  int i = 0;
  int V = 0;
  bool nov = true;
  while (1) {
    for (int i = 0; i < n; i++)
      if (!v[i] and gy >= a[i]) {
        v[i] = true;
        gy++;
      }
    if (gy == n) break;
    V++;
    for (int i = n - 1; i >= 0; i--)
      if (!v[i] and gy >= a[i]) {
        v[i] = true;
        gy++;
      }
    if (gy == n) break;
    V++;
  }
  cout << V << endl;
}
