using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class15
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool[] frag = new bool[N];
            for (int i = 0; i < N; i++)
                frag[i] = p[i] == i+1 ? true : false;

            int count = 0;
            for(int i = 0; i < N-1; i++)
            {
                if (frag[i])
                {
                    frag[i] = false;
                    frag[i + 1] = false;
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}
