<?php
// Try AtCoder
// author: Leonardone @ NEETSDKASU

function gets() { return trim(fgets(STDIN)); }
function getVals() { return explode(' ', gets()); }
function getInts() { return array_map(intval, getVals()); }

$N = intval(gets());
$xs = getInts();

$ans = 0;

for ($i = 0; $i + 1 < $N; $i++) {
    if ($xs[$i] === $i + 1) {
        if ($i > 0) {
            $ans++;
        } else {
            $t = $xs[$i];
            $xs[$i] = $xs[$i+1];
            $xs[$i+1]= $t;
            $ans++;
        }
    }
}

echo $ans, PHP_EOL;