#include <bits/stdc++.h>
int main() {
  int n, j;
  scanf("%d", &n);
  int flag = 0;
  int out = 0;
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", &j);
    if (i == j) {
      flag++;
      out++;
    } else {
      if (flag > 1) {
        out = out - flag / 2;
      }
      flag = 0;
    }
  }
  printf("%d", out);
}
