using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var w = new int[n + 1];
        string[] line = Console.ReadLine().Trim().Split(' ');
        var count = 0;
        for (int i = 0; i < n; i++)
            w[i + 1] = int.Parse(line[i]);
        for (int i = 1; i < n; i++)
        {
            if (w[i] == i && i != n-1    ) { swap(w, i); count++; }
            if (w[i] == i && i == n - 1) { swap(w, i-1); count++; }
        }
        Console.WriteLine(count);
    }
    public static void swap(int[] w, int a)
    {
        var t = w[a];
        w[a] = w[a + 1];
        w[a + 1] = t;
    }
}