#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
template <class T>
const T& max(const T& a, const T& b, const T& c) {
  return max(a, max(b, c));
}
template <class T>
const T& min(const T& a, const T& b, const T& c) {
  return min(a, min(b, c));
}
struct sp {
  bool operator()(const pair<string, int>& a, const pair<string, int>& b) {
    if (a.second != b.second) {
      return (a.second > b.second);
    }
    return (a.first < b.first);
  }
};
long long stoi(string& str) {
  istringstream second(str);
  long long i;
  second >> i;
  return i;
}
string itos(long long i) {
  stringstream second;
  second << i;
  return second.str();
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool vis[10001];
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  bool right = true;
  int c = 0;
  int total = 0;
  int p = 0;
  while (total < v.size()) {
    if (right) {
      for (int i = 0; i < v.size(); i++) {
        if (p >= v[i] && !vis[i]) {
          vis[i] = 1;
          p++;
          total++;
        }
      }
      right = false;
    } else {
      for (int i = v.size() - 1; i >= 0; i--) {
        if (p >= v[i] && !vis[i]) {
          vis[i] = 1;
          p++;
          total++;
        }
      }
      right = true;
    }
    if (total < v.size()) c++;
  }
  cout << c << endl;
  return 0;
}
