import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    } N < 2 N 2 {
    	System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    } int a a b b count; count String output = "Yes"; output "Yes" a = sc.nextInt() a sc.nextInt() sc.nextInt sc count = 0 count 0 for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	} {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	} b = sc.nextInt() b sc.nextInt() sc.nextInt sc if(b - a <= -2) {
    			output = "No";
    			break;
    		} b - a <= -2 b - a b a -2 2 {
    			output = "No";
    			break;
    		} output = "No" output "No" break; if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		} b - a == -1 b - a b a -1 1 {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		} count++ count if(count == 2) {
        			output = "No";
        			break;
        		} count == 2 count 2 {
        			output = "No";
        			break;
        		} output = "No" output "No" break; if(b - a > 0) {
    			count = 0;
    		} b - a > 0 b - a b a 0 {
    			count = 0;
    		} count = 0 count 0 a = b a b System.out.println(output) System.out.println System.out System System.out output sc.close() sc.close sc String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if(N < 2) {
    	System.out.println("Yes");
    }
    else {
    	int a, b, count;
    	String output = "Yes";
    	a = sc.nextInt();
    	//b = sc.nextInt();
    	count = 0;
    	for(int i = 1; i < N; i++) {
    		b = sc.nextInt();
    		if(b - a <= -2) {
    			output = "No";
    			break;
    		}
    		if(b - a == -1) {
    			count++;
    			if(count == 2) {
        			output = "No";
        			break;
        		}
    		}else if(b - a > 0) {
    			count = 0;
    		}
    		a = b;
    	}
    	System.out.println(output);
    	sc.close();
    }
  }
}