import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    } main {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n int max = -1; max -1 1 for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        } {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc if (max - array[i] > 1) {
                System.out.println("No");
                return;
            } max - array[i] > 1 max - array[i] max array[i] array i 1 {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; max = Math.max(max, array[i]) max Math.max(max, array[i]) Math.max Math max array[i] array i System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int max = -1;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            if (max - array[i] > 1) {
                System.out.println("No");
                return;
            }
            max = Math.max(max, array[i]);
        }
        System.out.println("Yes");
    }
}