using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
	public static void Main()
	{
		var n = int.Parse(ReadLine());
		var a = ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
		var b = new bool[n].Select((x, i) => a[i] == i).ToArray();
		var count = 0;
		for(int i = 0; i < n - 1; i++)
		{
			if(b[i])
			{
				count++;
				var temp = a[i];
				a[i] = a[i + 1];
				a[i + 1] = temp;
				b[i] = false;
				b[i + 1] = i + 1 == a[i + 1];
			}
		}
		WriteLine(count);
	}
}
