using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var judge = new bool[n];

            for (var i = 1; i <= n; i++)
                if (i == p[i - 1]) judge[i - 1] = true;

            var total = 0L;
            for (var i = 1; i < n; i+=2)
                if (judge[i - 1] || judge[i]) total++;

            if (n % 2 == 1) if (judge[n - 1]) total++;

            Console.WriteLine(total);
        }
    }
}
