import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	}
} Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	} main {
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		} a == 1 a 1 {
		    System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		} int grid[] = new int[a]; grid new int[a] a for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
    		    grid[i] = sc.nextInt();
    		} {
    		    grid[i] = sc.nextInt();
    		} grid[i] = sc.nextInt() grid[i] grid i sc.nextInt() sc.nextInt sc for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		} {
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		} if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    } i == 0 i 0 {
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    } if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        } grid[0] > grid[1] && grid[0] > 1 grid[0] > grid[1] grid[0] grid 0 grid[1] grid 1 grid[0] > 1 grid[0] grid 0 1 {
    		            grid[0]--;
    		        } grid[0]-- grid[0] grid 0 {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    } if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        } grid[i] > grid[i-1] && grid[i] > 1 grid[i] > grid[i-1] grid[i] grid i grid[i-1] grid i-1 i 1 grid[i] > 1 grid[i] grid i 1 {
    		            grid[i]--;
    		        } grid[i]-- grid[i] grid i boolean flg = true; flg true for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		} {
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		} if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    } i == 0 i 0 {
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    } if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        } grid[0] > grid[1] grid[0] grid 0 grid[1] grid 1 {
    		            flg = false;
    		            break;
    		        } flg = false flg false break; {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    } if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        } grid[i] < grid[i-1] grid[i] grid i grid[i-1] grid i-1 i 1 {
    		            flg = false;
    		            break;
    		        } flg = false flg false break; if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		} flg == true flg true {
    		    System.out.println("Yes");
    		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
    		    System.out.println("No");
    		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	}
} public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		
		if(a == 1){
		    System.out.println("Yes");
		}
		else
		{
		    int grid[] = new int[a];
		    
		    //準備
    		for(int i = 0; i < a; i++){
    		    grid[i] = sc.nextInt();
    		}
    		
    		//操作
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1] && grid[0] > 1){
    		            grid[0]--;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] > grid[i-1] && grid[i] > 1){
    		            grid[i]--;
    		        }
    		    }

    		}
    		
    		//検査
    		boolean flg = true;
    		for(int i = 0; i < a; i++){
    		    if(i == 0){
    		        if(grid[0] > grid[1]){
    		            flg = false;
    		            break;
    		        }
    		    }
    		    else
    		    {
    		        if(grid[i] < grid[i-1]){
    		            flg = false;
    		            break;
    		        }
    		    }

    		}
    		
    		if(flg == true){
    		    System.out.println("Yes");
    		}
    		else
    		{
    		    System.out.println("No");
    		}
    	    
            
		}
		
	}
}