import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto p = readln.split.to!(int[]);

  auto r = 0;
  foreach (i; 0..n-1) {
    if (i+1 == p[i]) {
      swap(p[i], p[i+1]);
      ++r;
    }
  }
  if (p[n-1] == n) ++r;
  writeln(r);
}
