import java.util.Scanner;

public class Main {

    void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    } solve {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    } 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 for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        } int i = N - 1; int i = N - 1; i N - 1 N 1 i > 0 i 0 i-- i-- i {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        } {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        } if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            } H[i - 1] > H[i] H[i - 1] H i - 1 i 1 H[i] H i {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            } H[i - 1]-- H[i - 1] H i - 1 i 1 if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                } 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; System.out.print("Yes") System.out.print System.out System System.out "Yes" // Main
    public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args public class Main {

    void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} public class Main {

    void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
} Main
import java.util.Scanner;

public class Main {

    void solve() {
        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();
        }
        for (int i = N - 1; i > 0; i--) {
            if (H[i - 1] > H[i]) {
                H[i - 1]--;
                if (H[i - 1] > H[i]) {
                    System.out.print("No");
                    return;
                }
            }
        }
        System.out.print("Yes");
    }

    // Main
    public static void main(String[] args) {
        new Main().solve();
    }
}

