import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] h = new int[n]; h new int[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] h i scan.nextInt() scan.nextInt scan for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        } 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]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        } {
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        } if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            } h[i] <= h[i + 1] h[i] h i h[i + 1] h i + 1 i 1 {
                
            } if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            } h[i] - h[i + 1] == 1 h[i] - h[i + 1] h[i] h i h[i + 1] h i + 1 i 1 1 {
                h[i]--;
            } h[i]-- h[i] h i if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            } h[i] != h[i + 1] h[i] h i h[i + 1] h i + 1 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" scan.close() scan.close scan String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] h = new int[n];
        for(int i = 0; i < n; i++) h[i] = scan.nextInt();
        for(int i = n - 2; i >= 0; i--){
            if(h[i] <= h[i + 1]){
                
            }else if(h[i] - h[i + 1] == 1){
                h[i]--;
            }else if(h[i] != h[i + 1]){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
        scan.close();
    }
}