
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    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) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

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

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.println("Yes");
    } main {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.println("Yes");
    } final Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) final int counter = scanner.nextInt(); counter scanner.nextInt() scanner.nextInt scanner int left = 0; left 0 for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i < counter i counter i++ i++ i {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        } {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        } final int stair = scanner.nextInt() - 1; stair scanner.nextInt() - 1 scanner.nextInt() scanner.nextInt scanner 1 if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            } stair >= left stair left {
                left = stair;
            } left = stair left stair {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            } if (left > stair + 1) {
                    System.out.println("No");
                    return;
                } left > stair + 1 left stair + 1 stair 1 {
                    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) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

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

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

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

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();

        int left = 0;
        for (int i = 0; i < counter; i++) {
            final int stair = scanner.nextInt() - 1;
            if (stair >= left) {
                left = stair;
            } else {
                if (left > stair + 1) {
                    System.out.println("No");
                    return;
                }
            }
        }

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