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