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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            string[] input = Console.ReadLine().Split(' ');

            int[] x = new int[N];


            int ans = 0;
            int t = 0;

            for(int i = 0; i < N; i++)
            {
                x[i] = int.Parse(input[i]); //string型をint型に変更


                if(x[i] == i + 1)
                {
                   if(i < N - 1)
                    {
                        t = x[i + 1];
                        x[i + 1] = x[i];
                        x[i] = t;

                        ans++;
                    }
                    else //Pn=Nのとき
                    {
                        t = x[i - 1];
                        x[i - 1] = x[i];
                        x[i] = t;

                        ans++;
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}
