#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int x = 0;
  int y = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == i + 1) {
      y++;
    } else {
      x = x + (y + 1) / 2;
      y = 0;
    }
  }
  printf("%d", x);
  return 0;
}
