#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, ans = 0, cnt = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    if (a != i) {
      ans += cnt / 2;
      cnt = 1;
    } else
      cnt++;
  }
  printf("%d\n", ans);
}
