#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    int n;
    int *p;
    int i;
    int tmp;
    int cnt = 0;


    p = malloc(sizeof(int)*100000);
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%d", &p[i]);
    }
    for (i = 0; i < n-1; i++){
        if (p[i] == i+1){
            tmp = p[i];
            p[i] = p[i+1];
            p[i+1] = tmp;
            cnt++;
        }
    }

    printf("%d\n", cnt);
    return 0;

}