import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    }
} Main public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    } main {
        solve(System.in, System.out);
    } solve(System.in, System.out) solve System.in System System.in System.out System System.out String[] args args static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    } solve {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    } Scanner scan = new Scanner(is); scan new Scanner(is) Integer N = scan.nextInt(); N scan.nextInt() scan.nextInt scan long H[] = new long[N]; H new long[N] N for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            H[i] = scan.nextInt();
        } {
            H[i] = scan.nextInt();
        } H[i] = scan.nextInt() H[i] H i scan.nextInt() scan.nextInt scan for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        } int i = N - 1 ; int i = N - 1 ; i N - 1 N 1 0 < i 0 i i-- i-- i {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        } {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        } if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            } H[i-1] <= H[i] H[i-1] H i-1 i 1 H[i] H i continue; if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            } H[i-1] - 1 == H[i] H[i-1] - 1 H[i-1] H i-1 i 1 1 H[i] H i H[i-1] = H[i-1] - 1 H[i-1] H i-1 i 1 H[i-1] - 1 H[i-1] H i-1 i 1 1 {
                os.println("No");
                return;
            } os.println("No") os.println os "No" return; os.println("Yes") os.println os "Yes" InputStream is is PrintStream os os public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        Integer N = scan.nextInt();
        long H[] = new long[N];
        for(int i = 0; i < N; i++) {
            H[i] = scan.nextInt();
        }
        for (int i = N - 1 ; 0 < i ; i--) {
            if(H[i-1] <= H[i])
                continue;
            else if(H[i-1] - 1 == H[i])
                H[i-1] = H[i-1] - 1;
            else {
                os.println("No");
                return;
            }
        }

        os.println("Yes");
    }
}