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 key = 0;
            int t = 0;

            for(int i = 0; i < N; i++)
            {
                int x = int.Parse(input[i]);

                t++;

                if(x == (i + 1))
                {
                    input[i] = input[t + 1];
                    input[i + 1] = input[t];
                    key += 1;
                }
            }

            Console.WriteLine(key);
        }
    }
}