#include <bits/stdc++.h>
using namespace std;
long long sum, res, n, a[1010];
bool crk[1010];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    crk[i] = false;
  }
  sum = 0;
  res = 0;
  for (;;) {
    if (sum == n) break;
    for (int i = 1; i <= n; i++) {
      if (!crk[i] && sum >= a[i]) {
        crk[i] = true;
        sum++;
      }
    }
    if (sum == n) break;
    res++;
    for (int i = n; i >= 1; i--) {
      if (!crk[i] && sum >= a[i]) {
        crk[i] = true;
        sum++;
      }
    }
    if (sum == n) break;
    res++;
  }
  cout << res << "\n";
  return 0;
}
