import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            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 line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        }
    }

} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        String line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line1 = scanner.nextLine(); line1 scanner.nextLine() scanner.nextLine scanner int count = Integer.parseInt(line1); count Integer.parseInt(line1) Integer.parseInt Integer line1 if (count == 1) {
            System.out.println("Yes");
            return;
        } count == 1 count 1 {
            System.out.println("Yes");
            return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; String line2 = scanner.nextLine(); line2 scanner.nextLine() scanner.nextLine scanner String[] token = line2.split(" "); token line2.split(" ") line2.split line2 " " int[] height = new int[count]; height new int[count] count for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
            height[i] = Integer.parseInt(token[i]);
        } {
            height[i] = Integer.parseInt(token[i]);
        } height[i] = Integer.parseInt(token[i]) height[i] height i Integer.parseInt(token[i]) Integer.parseInt Integer token[i] token i try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        } catch (RuntimeException e) {
            System.out.println("No");
        } RuntimeException e {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } int[] newHeight = new int[count]; newHeight new int[count] count for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            } int i = count - 1; int i = count - 1; i count - 1 count 1 i > 0 i 0 i-- i-- i {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            } {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            } if (i == count - 1) {
                    newHeight[i] = height[i];
                } i == count - 1 i count - 1 count 1 {
                    newHeight[i] = height[i];
                } newHeight[i] = height[i] newHeight[i] newHeight i height[i] height i int diff = height[i - 1] - newHeight[i]; diff height[i - 1] - newHeight[i] height[i - 1] height i - 1 i 1 newHeight[i] newHeight i if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                } diff > 1 diff 1 {
                    throw new RuntimeException();
                } throw new RuntimeException(); new RuntimeException() if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                } diff == 1 diff 1 {
                    newHeight[i - 1] = height[i - 1] - 1;
                } newHeight[i - 1] = height[i - 1] - 1 newHeight[i - 1] newHeight i - 1 i 1 height[i - 1] - 1 height[i - 1] height i - 1 i 1 1 {
                    newHeight[i - 1] = height[i - 1];
                } newHeight[i - 1] = height[i - 1] newHeight[i - 1] newHeight i - 1 i 1 height[i - 1] height i - 1 i 1 for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            } int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            } {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            } System.err.print(newHeight[i]) System.err.print System.err System System.err newHeight[i] newHeight i System.err.print(" ") System.err.print System.err System System.err " " System.err.println() System.err.println System.err System System.err 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 scanner = new Scanner(System.in);
        String line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        }
    }

} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            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 line1 = scanner.nextLine();
        int count = Integer.parseInt(line1);

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

        String line2 = scanner.nextLine();
        String[] token = line2.split(" ");
        int[] height = new int[count];
        for (int i = 0; i < count; i++) {
            height[i] = Integer.parseInt(token[i]);
        }

        try {
            int[] newHeight = new int[count];
            for (int i = count - 1; i > 0; i--) {
                if (i == count - 1) {
                    newHeight[i] = height[i];
                }
                int diff = height[i - 1] - newHeight[i];
                if (diff > 1) {
                    throw new RuntimeException();
                } else if (diff == 1) {
                    newHeight[i - 1] = height[i - 1] - 1;
                } else {
                    newHeight[i - 1] = height[i - 1];
                }
            }
            for (int i = 0; i < count; i++) {
                System.err.print(newHeight[i]);
                System.err.print(" ");
            }
            System.err.println();

            System.out.println("Yes");
        } catch (RuntimeException e) {
            System.out.println("No");
        }
    }

}
