import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] H = new int[N]; H new int[N] N for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = Integer.parseInt(sc.next());
        } {
            H[i] = Integer.parseInt(sc.next());
        } H[i] = Integer.parseInt(sc.next()) H[i] H i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        } {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        } int diff = H[i] - H[i - 1]; diff H[i] - H[i - 1] H[i] H i H[i - 1] H i - 1 i 1 if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            } diff == 0 diff 0 {
            } if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            } diff > 0 diff 0 {
                H[i] = H[i] - 1;
            } H[i] = H[i] - 1 H[i] H i H[i] - 1 H[i] H i 1 {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; 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 = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = Integer.parseInt(sc.next());
        }

        for (int i = 1; i < N; i++) {
            int diff = H[i] - H[i - 1];
            if (diff == 0) {
            } else if (diff > 0) {
                H[i] = H[i] - 1;
            } else {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}