using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int i = 0;
        int c = 1;
        int N = int.Parse(Console.ReadLine());

        List<int> L = new List<int>();
        string[] str = Console.ReadLine().Split(' ');
        foreach (string s in str){
            if(c < int.Parse(str[i])){
                Console.WriteLine("No");
                break;
            }else if(c > int.Parse(str[i])){
                Console.WriteLine("No");
                break;
            }else if(c == int.Parse(str[i])){
                L.Add(int.Parse(s));
                i += 1;
                c += 1;
            }

            if(N==c){
                Console.WriteLine("Yes");
                break;
            }
        }  
        
    }
}