#include <bits/stdc++.h>
using namespace std;
int n, p[100001], dp[100001];
int rec(int idx) {
  if (idx == n) return 0;
  if (idx < 0) return 100000000;
  if (~dp[idx]) return dp[idx];
  int ret = 100000000;
  if (idx + 1 == p[idx]) {
    swap(p[idx], p[idx + 1]);
    ret = min(ret, rec(idx + 1) + 1);
    swap(p[idx], p[idx + 1]);
    swap(p[idx], p[idx - 1]);
    ret = min(ret, rec(idx - 1) + 1);
    swap(p[idx], p[idx - 1]);
  } else {
    ret = rec(idx + 1);
  }
  return dp[idx] = ret;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(0) << endl;
}
