using System;
using System.Linq;
using System.Collections.Generic;
class Hello
{
    static public IEnumerable<bool> Check<T>(T[] t)
    {
        for (int i = 0; i < t.Length; i++)
        {
            if (t[i].Equals(i + 1))
            {
                yield return true;
            }
            else
            {
                yield return false;
            }
        }
    }

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var p = Console.ReadLine().Split().Select(int.Parse).ToArray();

        int counter = 0;
        var checkedP = Check(p);
        for (int i = 0; i < n/2; i++)
        {
            var aa = checkedP.Skip(i * 2).Take(2).ToArray();
            if(aa.Any(e=>e))
            {
                counter++;
            }
        }
        Console.WriteLine(counter);
    }

}