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

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            new Solution().answer();
        }
    }

    class Solution
    {
        string N,M ;
        int T = 0;

        public Solution()
        {
            N = Console.ReadLine();
            M = Console.ReadLine();
            int j = Convert.ToInt32(N);      
            string[] M_split = new string[j];
            //string temp1, temp2;

            M_split = M.Split(' ');
            int i;
            for (i = 0; i <= j - 1; i++)
            {
                if (i + 1 == Convert.ToInt32(M_split[i]) && i+1<= j-1)
                {
                    //M_split[i] = temp2;
                    //M_split[i+1] = temp1;
                    T++;
                    i++;
                }                         
            }

            if (j%2==1 && Convert.ToInt32(M_split[j - 1]) == j) { T++; }

        }

        public void answer()
        {
            Console.WriteLine(T.ToString());
        }
    }
}
