#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
string s;
long long n, i, j, m, x, y, z, b, c, cc, ccc;
long long a[1005];
bool ri = true, le = false;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (1) {
    if (a[cc] <= c && a[cc] != -1) {
      c++;
      a[cc] = -1;
      if (c == n) break;
    }
    if (cc == n - 1 && ri) {
      cc = n;
      ri = false;
      le = true;
      ccc++;
    } else if (cc == 0 && le) {
      cc = -1;
      ri = true;
      le = false;
      ccc++;
    }
    if (ri) cc++;
    if (le) cc--;
  }
  cout << ccc << endl;
  return 0;
}
