import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String N = scanner.nextLine(); N scanner.nextLine() scanner.nextLine scanner int n = Integer.parseInt(N); n Integer.parseInt(N) Integer.parseInt Integer N String line = scanner.nextLine(); line scanner.nextLine() scanner.nextLine scanner String[] strs = line.split(" "); strs line.split(" ") line.split line " " int[] values = new int[strs.length]; values new int[strs.length] strs.length strs strs.length for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        } int i = 0; int i = 0; i 0 i < strs.length i strs.length strs strs.length i++ i++ i {
            values[i] = Integer.parseInt(strs[i]);
        } {
            values[i] = Integer.parseInt(strs[i]);
        } values[i] = Integer.parseInt(strs[i]) values[i] values i Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i boolean[] changed = new boolean[n]; changed new boolean[n] n boolean can = true; can true while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        } true {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        } boolean hasChanged = false; hasChanged false int i; i for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            } i = 1; i = 1 i 1 i < values.length i values.length values values.length i++ i++ i {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            } {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            } if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                } values[i] < values[i - 1] values[i] values i values[i - 1] values i - 1 i 1 {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                } if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    } !changed[i - 1] changed[i - 1] changed i - 1 i 1 {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } values[i - 1] = values[i - 1] - 1 values[i - 1] values i - 1 i 1 values[i - 1] - 1 values[i - 1] values i - 1 i 1 1 changed[i - 1] = true changed[i - 1] changed i - 1 i 1 true hasChanged = true hasChanged true {
                        can = false;
                        break;
                    } can = false can false break; if (hasChanged) {
                continue;
            } hasChanged {
                continue;
            } continue; if (i >= values.length || !can) {
                break;
            } i >= values.length || !can i >= values.length i values.length values values.length !can can {
                break;
            } break; if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } can {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String N = scanner.nextLine();
        int n = Integer.parseInt(N);
        String line = scanner.nextLine();
        String[] strs = line.split(" ");
        int[] values = new int[strs.length];

        for (int i = 0; i < strs.length; i++) {
            values[i] = Integer.parseInt(strs[i]);
        }

        boolean[] changed = new boolean[n];
        boolean can = true;
        while (true) {
            boolean hasChanged = false;
            int i;
            for (i = 1; i < values.length; i++) {
                if (values[i] < values[i - 1]) {
                    if (!changed[i - 1]) {
                        values[i - 1] = values[i - 1] - 1;
                        changed[i - 1] = true;
                        hasChanged = true;
                    } else {
                        can = false;
                        break;
                    }
                }
            }
            if (hasChanged) {
                continue;
            }
            if (i >= values.length || !can) {
                break;
            }
        }
        if(can) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
