import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        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 if (n == 1) {
            System.out.println("Yes");
            return;
        } n == 1 n 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; int[] list = new int[n]; list new int[n] n for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list[i] = sc.nextInt();
        } {
            list[i] = sc.nextInt();
        } list[i] = sc.nextInt() list[i] list i sc.nextInt() sc.nextInt sc for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        } {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        } if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            } list[i-1] == list[i] list[i-1] list i-1 i 1 list[i] list i continue; if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            } list[i-1] <= list[i]-1 list[i-1] list i-1 i 1 list[i]-1 list[i] list i 1 list[i] -- list[i] list i {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; 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) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        if (n == 1) {
            System.out.println("Yes");
            return;
        }

        int[] list = new int[n];
        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (list[i-1] == list[i]) continue;
            else if (list[i-1] <= list[i]-1) list[i] --;
            else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}
