import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] h = new int[n]; h new int[n] n for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = sc.nextInt();
        } {
            h[i] = sc.nextInt();
        } h[i] = sc.nextInt() h[i] h i sc.nextInt() sc.nextInt sc boolean isAns = true; isAns true if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        } n >= 2 n 2 {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        } for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            } int i = n - 2; int i = n - 2; i n - 2 n 2 i >= 0 i 0 i-- i-- i {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            } {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            } if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                } h[i] > h[i+1] h[i] h i h[i+1] h i+1 i 1 {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                } if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    } h[i]-1 <= h[i+1] h[i]-1 h[i] h i 1 h[i+1] h i+1 i 1 {
                        h[i]--;
                    } h[i]-- h[i] h i {
                        isAns = false;
                        break;
                    } isAns = false isAns false break; System.out.println(isAns ? "Yes" : "No") System.out.println System.out System System.out isAns ? "Yes" : "No" isAns "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] h = new int[n];

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

        boolean isAns = true;
        if (n >= 2) {
            for (int i = n - 2; i >= 0; i--) {
                if (h[i] > h[i+1]) {
                    if (h[i]-1 <= h[i+1]) {
                        h[i]--;
                    } else {
                        isAns = false;
                        break;
                    }
                }
            }
        }

        System.out.println(isAns ? "Yes" : "No");
    }
}