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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = int.Parse(Console.ReadLine());
        int[] p = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var ans = 0;
        for (int i = 0; i < n-1; i++)
        {
            if (p[i] == i + 1)
            {
                var tmp = p[i];
                p[i] = p[i + 1];
                p[i + 1] = tmp;

                ans++;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}