#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-5;
const int MAXN = 1005;
int n, m, tt;
int vis[MAXN], vis2[MAXN];
int a[MAXN];
int main() {
  int i, j, k, ca = 1;
  while (scanf("%d", &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    int ans = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", a + i);
    }
    int sum = 0;
    while (1) {
      for (i = 0; i < n; i++) {
        if (!vis[i]) {
          if (sum >= a[i]) {
            sum++;
            vis[i] = 1;
          }
        }
      }
      if (sum == n) break;
      ans++;
      for (i = n - 1; i >= 0; i--) {
        if (!vis[i]) {
          if (sum >= a[i]) {
            sum++;
            vis[i] = 1;
          }
        }
      }
      if (sum == n) break;
      ans++;
    }
    printf("%d\n", ans);
  }
}
