using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        long n = Read.Long();
        long[] a = Read.longs();
        long ans = 0;
        List<long> s = new List<long> { };
        for (long i = 0; i < n; i++)
        {
            if (a[i] == i + 1) { ans++; s.Add(i); }
        }
        for(int i = 1; i < s.Count(); i++)
        {
            if (s[i-1] + 1 == s[i]) { ans--; s.Remove(i);s.Remove(i-1); }
        }
        Console.WriteLine(ans);
        Console.ReadLine();
    }
}
    public static class Read
{
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
 }