#include <bits/stdc++.h>
int parse(char *text);
int main(void) {
  int n, i, p_idx, count;
  int perm[100000 + 1];
  char buf[7];
  scanf("%d%*c", &n);
  i = 0;
  p_idx = 1;
  while (1) {
    int flag = 0;
    scanf("%c", &buf[i]);
    if (buf[i] == ' ' || buf[i] == '\n') {
      if (buf[i] == '\n') flag = 1;
      buf[i] = '\0';
      perm[p_idx++] = parse(buf);
      if (flag) break;
      i = 0;
      continue;
    }
    i++;
  }
  count = 0;
  for (i = 1; i < n; i++) {
    if (i == perm[i]) {
      count++;
      if (i + 1 == perm[i + 1]) {
        i++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
int parse(char *text) {
  int i, ret, len;
  i = 0;
  while (1) {
    if (text[i] == '\0') {
      len = i;
      break;
    }
    i++;
  }
  ret = 0;
  for (i = len - 1; i >= 0; i--) {
    int a = 1, j;
    for (j = 0; j < len - i - 1; j++) a *= 10;
    ret += (int)(text[i] - '0') * a;
  }
  return ret;
}
