#include <bits/stdc++.h>
using namespace std;
int n;
int ans = 0;
int now = 0;
int vis_c = 0;
bool vis[1000];
int items[1000];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> items[i];
  while (1) {
    for (int i = 0; i < n; i++) {
      if (items[i] <= now && !vis[i]) {
        vis[i] = 1;
        vis_c++;
        now++;
      }
    }
    if (vis_c == n) break;
    ans++;
    for (int i = n - 1; i >= 0; i--) {
      if (items[i] <= now && !vis[i]) {
        vis[i] = 1;
        vis_c++;
        now++;
      }
    }
    if (vis_c == n) break;
    ans++;
  }
  cout << ans;
  return 0;
}
