#include <bits/stdc++.h>
using namespace std;
vector<int> v[1005];
int a[1005];
bool coll[1005];
int main() {
  int i, j, n, m, ans = 0, energy = 0, c = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    coll[i] = false;
  }
  while (c < n) {
    for (i = 1; i <= n; i++) {
      if (a[i] <= energy && coll[i] == false) energy++, c++, coll[i] = true;
    }
    if (c < n)
      ans++;
    else
      break;
    for (i = n; i >= 1; i--) {
      if (a[i] <= energy && coll[i] == false) energy++, c++, coll[i] = true;
    }
    if (c < n) ans++;
  }
  cout << ans;
  return 0;
}
