import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] h = new long[n];
        long[] buff = new long[n];
        boolean f = true;
        for (int i = 0; i < n; i++) {
            h[i] = sc.nextLong();
            if (i>0) {
                if (h[i]<h[i-1]) {
                    long diff=h[i-1]-h[i];
                    if ( buff[i-1] !=0 || diff>1 ) f=false;
                    else buff[i]=1;
                }
                else if (h[i]==h[i-1]) buff[i]=buff[i-1];
            }
        }
        System.out.println(f ? "Yes" : "No");
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz