#include <bits/stdc++.h>
using namespace std;
struct sort_pred {
  bool operator()(const std::pair<int, int> &left,
                  const std::pair<int, int> &right) {
    return left.second < right.second;
  }
};
int gcd(int a, int b) { return (a == 0) ? b : gcd(b % a, a); }
long long powmod(long long a, long long b) {
  if (b == 0) return 1;
  long long x = powmod(a, b / 2);
  long long y = (x * x) % 1000000007;
  if (b % 2) return (a * y) % 1000000007;
  return y % 1000000007;
}
int main() {
  bool vis[10000] = {false};
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a[10004];
  cin >> n;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  int cnt = 0, i = 0, d = 1;
  int ans1 = 0, ans2 = 0;
  while (cnt < n) {
    if (d == 1) {
      bool first = false;
      int tmp = i;
      for (; i < n; i++)
        if (a[i] <= cnt && !vis[i]) {
          cnt++;
          vis[i] = true;
          first = true;
          break;
        }
      if (first)
        continue;
      else {
        ans1++;
        bool first = false;
        d = 2;
        i = tmp;
        for (; i >= 0; i--)
          if (a[i] <= cnt && !vis[i]) {
            cnt++;
            vis[i] = true;
            first = true;
            break;
          }
        if (first) continue;
      }
    } else {
      bool first = false;
      int tmp = i;
      for (; i >= 0; i--)
        if (a[i] <= cnt && !vis[i]) {
          cnt++;
          vis[i] = true;
          first = true;
          break;
        }
      if (first)
        continue;
      else {
        ans1++;
        bool first = false;
        d = 1;
        i = tmp;
        for (; i < n; i++)
          if (a[i] <= cnt && !vis[i]) {
            cnt++;
            vis[i] = true;
            first = true;
            break;
          }
        if (first) continue;
      }
    }
  }
  cnt = 0;
  d = 2;
  memset(vis, false, sizeof(vis));
  i = n - 1;
  while (cnt < n) {
    if (d == 1) {
      bool first = false;
      int tmp = i;
      for (; i < n; i++)
        if (a[i] <= cnt && !vis[i]) {
          cnt++;
          vis[i] = true;
          first = true;
          break;
        }
      if (first)
        continue;
      else {
        ans2++;
        bool first = false;
        d = 2;
        i = tmp;
        for (; i >= 0; i--)
          if (a[i] <= cnt && !vis[i]) {
            cnt++;
            vis[i] = true;
            first = true;
            break;
          }
        if (first) continue;
      }
    } else {
      bool first = false;
      int tmp = i;
      for (; i >= 0; i--)
        if (a[i] <= cnt && !vis[i]) {
          cnt++;
          vis[i] = true;
          first = true;
          break;
        }
      if (first)
        continue;
      else {
        ans2++;
        bool first = false;
        d = 1;
        i = tmp;
        for (; i < n; i++)
          if (a[i] <= cnt && !vis[i]) {
            cnt++;
            vis[i] = true;
            first = true;
            break;
          }
        if (first) continue;
      }
    }
  }
  cout << ans1 << "\n";
  return 0;
}
