<?php
error_reporting(0);
//list($x,$t) = explode(" ",trim(fgets(STDIN)));
$N = trim(fgets(STDIN));
$p = explode(" ",trim(fgets(STDIN)));
$swap=0;
for($i=0;$i<$N/2;$i=$i+2) {
  if ($i+1 == $p[$i] || $i+2 == $p[$i+1])
    $swap++;
}
if ($N % 2 == 1) {
  if ($p[$N-1] == $N)
    $swap++;
}
printf("%d\n",$swap);
