#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  vector<bool> taken(n);
  int info = 0;
  int pos = 0;
  int direction = 1;
  int ans = 0;
  bool start = true;
  while (true) {
    if (!taken[pos] && info >= v[pos]) {
      taken[pos] = true;
      info++;
      if (info == n) break;
    }
    if (pos == n - 1) {
      direction = 2;
      ans++;
    } else if (pos == 0) {
      direction = 1;
      if (start)
        start = false;
      else
        ans++;
    }
    if (direction == 1)
      pos++;
    else if (direction == 2)
      pos--;
  }
  cout << ans << endl;
}
