#include <bits/stdc++.h>
using namespace std;
int a[1005];
bool vis[1005];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int x1 = n + 1, x2 = -1;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      if (!a[i]) x1 = min(x1, i), x2 = max(x2, i);
    }
    memset(vis, 0, sizeof(vis));
    int cur = 0, ans = 0;
    while (true) {
      bool flag = 0;
      for (int i = 0; i < n; i++)
        if (!vis[i] && a[i] <= cur) vis[i] = 1, cur++, flag = 1;
      if (flag) ans++;
      if (cur >= n) break;
      flag = 0;
      for (int i = n - 1; i >= 0; i--)
        if (!vis[i] && a[i] <= cur) vis[i] = 1, cur++, flag = 1;
      if (flag) ans++;
      if (cur >= n) break;
    }
    printf("%d\n", ans - 1);
  }
  return 0;
}
