import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    }
} Main public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } debug {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    } boolean debug = false; debug false if (debug != false) {
            return;
        } debug != false debug false {
            return;
        } return; System.out.println(str) System.out.println System.out System System.out str String str str public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    } main {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    } int N; N long[] H; H try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        } {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc H = new long[N] H new long[N] N for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
                H[i] = sc.nextLong();
            } {
                H[i] = sc.nextLong();
            } H[i] = sc.nextLong() H[i] H i sc.nextLong() sc.nextLong sc long[] L = new long[N]; L new long[N] N for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            L[i] = H[i] -1;
        } {
            L[i] = H[i] -1;
        } L[i] = H[i] -1 L[i] L i H[i] -1 H[i] H i 1 if (H.length == 1) {
            System.out.println("Yes");
            return;
        } H.length == 1 H.length H H.length 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        } H.length == 2 && H[0] - H[1] <= 1 H.length == 2 H.length H H.length 2 H[0] - H[1] <= 1 H[0] - H[1] H[0] H 0 H[1] H 1 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; long min = H[0]; min H[0] H 0 for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        } {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        } if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            } min >H[i]&& min >L[i] min >H[i] min H[i] H i min >L[i] min L[i] L i {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; {
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            } if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                } min >H[i] min H[i] H i {
                    min = L[i];
                    continue;
                } min = L[i] min L[i] L i continue; if(min >L[i]){
                    min = H[i];
                    continue;
                } min >L[i] min L[i] L i {
                    min = H[i];
                    continue;
                } min = H[i] min H[i] H i continue; if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                } H[i] > L[i] H[i] H i L[i] L i {
                    min = L[i];
                } min = L[i] min L[i] L i {
                    min = H[i];
                } min = H[i] min H[i] H i System.out.println("Yes") System.out.println System.out System System.out "Yes" return; String[] args args public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    }
} public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    }
} Main
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long[] H;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            H = new long[N];
            for (int i = 0; i < N; i++) {
                H[i] = sc.nextLong();
            }
        }
        long[] L = new long[N];
        for (int i = 0; i < N; i++) {
            L[i] = H[i] -1;
        }



        if (H.length == 1) {
            System.out.println("Yes");
            return;
        }
        if (H.length == 2 && H[0] - H[1] <= 1) {
            System.out.println("Yes");
            return;
        }

        long min = H[0];
        for (int i = 1; i < N; i++) {
            if(min >H[i]&& min >L[i]){
                System.out.println("No");
                return;
            }else{
                if(min >H[i]){
                    min = L[i];
                    continue;
                }else if(min >L[i]){
                    min = H[i];
                    continue;
                }
                if(H[i] > L[i]){
                    min = L[i];
                }else{
                    min = H[i];
                }
            }

        }

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

    }
}
