import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int[] height = new int[num]; height new int[num] num for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            height[i] = sc.nextInt();
        } {
            height[i] = sc.nextInt();
        } height[i] = sc.nextInt() height[i] height i sc.nextInt() sc.nextInt sc boolean success = true; success true int max = height[0]; max height[0] height 0 for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        } int i = 0; int i = 0; i 0 i < height.length - 1 i height.length - 1 height.length height height.length 1 i++ i++ i {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        } {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        } if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            } height[i] > height[i + 1] height[i] height i height[i + 1] height i + 1 i 1 {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            } height[i]-- height[i] height i if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                } height[i] > height[i + 1] || max > height[i] height[i] > height[i + 1] height[i] height i height[i + 1] height i + 1 i 1 max > height[i] max height[i] height i {
                    success = false;
                    break;
                } success = false success false break; {
                    max = height[i];
                } max = height[i] max height[i] height i if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } success {
            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 sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int[] height = new int[num];
        for (int i = 0; i < num; i++) {
            height[i] = sc.nextInt();
        }
        boolean success = true;
        int max = height[0];
        for (int i = 0; i < height.length - 1; i++) {
            if (height[i] > height[i + 1]) {
                height[i]--;
                if (height[i] > height[i + 1] || max > height[i]) {
                    success = false;
                    break;
                } else {
                    max = height[i];
                }
            }
        }
        if (success) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
