#include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<pair<int, int>> vec;
int main() {
  int n, i, cnt = 0, dir = -1, x, sum = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    vec.push_back(make_pair(x, 0));
  }
  while (1) {
    if (cnt == vec.size()) break;
    for (i = 0; i < vec.size(); i++) {
      if (i == 0) dir++;
      if (sum >= vec[i].first && vec[i].second != 1) {
        cnt++;
        sum++;
        vec[i].second = 1;
      }
    }
    if (cnt == vec.size()) break;
    for (i = vec.size() - 1; i >= 0; i--) {
      if (i == 0) dir++;
      if (sum >= vec[i].first && vec[i].second != 1) {
        cnt++;
        sum++;
        vec[i].second = 1;
      }
    }
  }
  cout << dir << endl;
  return 0;
}
