using System.Collections.Generic;
using System.Linq;
using System;
class Program
{
    static void Main()
    {
        int count = int.Parse(Console.ReadLine());
        string line = Console.ReadLine();
        string[] strs = line.Split(' ');
        int[] nums = new int[count];

        for (int i = 0; i < count; i++)
        {
            nums[i] = int.Parse(strs[i]);
        }

        int threshold = 0;
        if(count % 2 == 0){
            threshold = count / 2;
        }else{
            threshold = (count + 1) / 2;
        }

        int swapCount = 0;
        for (int i = 0; i < count - 1; i++)
        {
            if(nums[i] == i + 1)
            {
                int replaceIndex = -1;
                for (int x = i + 1; x < count; x++)
                {
                    if(nums[x] > threshold)
                    {
                        replaceIndex = x;
                        break;
                    }
                }
                int temp = nums[i];
                nums[i] = nums[replaceIndex];
                nums[replaceIndex] = temp;

                swapCount++;
            }
        }

        Console.WriteLine(swapCount.ToString());
    }
}