#include <bits/stdc++.h>
int main(void) {
  int k, n;
  long long c = 0;
  int p[100010] = {};
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (p[i] == i && p[i + 1] != i + 1) {
      c++;
    }
  }
  printf("%lld\n", c);
  return 0;
}
