#include <bits/stdc++.h>
using namespace std;
int ans, cnt;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (1) {
    for (int i = 0; i < n; i++) {
      if (cnt >= a[i] && a[i] != -1) {
        cnt++;
        a[i] = -1;
      }
    }
    ans++;
    if (cnt >= n) break;
    for (int i = n - 1; i >= 0; i--) {
      if (cnt >= a[i] && a[i] != -1) {
        cnt++;
        a[i] = -1;
      }
    }
    ans++;
    if (cnt >= n) break;
  }
  cout << ans - 1;
}
