use v5.18;

chomp (my $n = <STDIN>);
chomp (my @p = split / /, <STDIN>);
my $ans = 0;
for my $i (0..$n-1) {
  if ($p[$i] == $i+1) {
    if ($p[$i] == $n-1) {
      ($p[$i], $p[$i-1]) = ($p[$i-1], $p[$i]);
    } else {
      ($p[$i], $p[$i+1]) = ($p[$i+1], $p[$i]);
    }
    $ans++;
  }
}
say $ans;