import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int old = sc.nextInt(); old sc.nextInt() sc.nextInt sc boolean used = false; used false for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        } {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        } int h  =sc.nextInt(); h sc.nextInt() sc.nextInt sc if (old > h + 1) {
                System.out.println("No");
                return;
            } old > h + 1 old h + 1 h 1 {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            } old == h + 1 old h + 1 h 1 {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            } if (used) {
                    System.out.println("No");
                    return;
                } used {
                    System.out.println("No");
                    return;
                } System.out.println("No") System.out.println System.out System System.out "No" return; used = true used true if (old < h) {
                used = false;
            } old < h old h {
                used = false;
            } used = false used false old = h old h 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 sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int old = sc.nextInt();
        boolean used = false;
        for (int i = 1; i < n; i++) {
            int h  =sc.nextInt();
            if (old > h + 1) {
                System.out.println("No");
                return;
            }
            if (old == h + 1) {
                if (used) {
                    System.out.println("No");
                    return;
                }
                used = true;
            }
            if (old < h) {
                used = false;
            }
            old = h;
        }
        System.out.println("Yes");
    }
}