#include <bits/stdc++.h>
using namespace std;
inline int nextInt();
const int N = 10000;
int a[N];
int main() {
  int n = nextInt();
  for (int i = 0; i < n; i++) {
    a[i] = nextInt();
  }
  int score = 0;
  int ans = 0;
  int pos = 0, dir = 1;
  while (score != n) {
    for (; pos >= 0 && pos < n; pos += dir) {
      if (score >= a[pos]) {
        a[pos] = 2e9;
        score++;
      }
    }
    if (score == n) break;
    ans++;
    if (dir == 1) {
      dir = -1;
      pos = n - 1;
    } else {
      dir = 1;
      pos = 0;
    }
  }
  printf("%d\n", ans);
  return 0;
}
inline int nextInt() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x;
}
