import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    } main {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ans = "Yes"; ans "Yes" int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] list = new int[n]; list new int[n] n for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list[i] = sc.nextInt();
        } {
            list[i] = sc.nextInt();
        } list[i] = sc.nextInt() list[i] list i sc.nextInt() sc.nextInt sc int lastValue = list[n - 1]; lastValue list[n - 1] list n - 1 n 1 for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        } int i = n - 2; int i = n - 2; i n - 2 n 2 i >= 0 i 0 i-- i-- i {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        } {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        } int value = list[i]; value list[i] list i if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            } value > lastValue value lastValue {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            } if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                } value - lastValue == 1 value - lastValue value lastValue 1 {
                    value--;
                } value-- value {
                    ans = "No";
                    break;
                } ans = "No" ans "No" break; lastValue = value lastValue value System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    }
} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        String ans = "Yes";

        int n = sc.nextInt();

        int[] list = new int[n];

        for (int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }

        int lastValue = list[n - 1];
        for (int i = n - 2; i >= 0; i--) {
            int value = list[i];
            if (value > lastValue) {
                if (value - lastValue == 1) {
                    value--;
                } else {
                    ans = "No";
                    break;
                }
            }
            lastValue = value;
        }

        System.out.println(ans);
    }
}