import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] h = new int[n]; h new int[n] n String[] nums = sc.nextLine().split(" "); nums sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = Integer.parseInt(nums[i]);
        } {
            h[i] = Integer.parseInt(nums[i]);
        } h[i] = Integer.parseInt(nums[i]) h[i] h i Integer.parseInt(nums[i]) Integer.parseInt Integer nums[i] nums i for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        } {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        } if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            } i >= 1  && h[i - 1] > h[i] i >= 1 i 1 h[i - 1] > h[i] h[i - 1] h i - 1 i 1 h[i] h i {
                System.out.print("No");
                return;
            } System.out.print("No") System.out.print System.out System System.out "No" return; if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            } i == 0 i 0 {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                } h[i] - 1 >= 1 h[i] - 1 h[i] h i 1 1 {
                    h[i] -= 1;
                } h[i] -= 1 h[i] h i 1 if (h[i - 1] < h[i]) {
                h[i] -= 1;
            } h[i - 1] < h[i] h[i - 1] h i - 1 i 1 h[i] h i {
                h[i] -= 1;
            } h[i] -= 1 h[i] h i 1 System.out.print("Yes") System.out.print System.out System System.out "Yes" String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] h = new int[n];

        String[] nums = sc.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            h[i] = Integer.parseInt(nums[i]);
        }

        for (int i = 0; i < n; i++) {
            if (i >= 1  && h[i - 1] > h[i]) {
                System.out.print("No");
                return;
            }

            if (i == 0) {
                if (h[i] - 1 >= 1) {
                    h[i] -= 1;
                }
            } else if (h[i - 1] < h[i]) {
                h[i] -= 1;
            }
        }
        System.out.print("Yes");
    }
}