import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] p = new int[n]; p new int[n] n boolean pd = true; pd true for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < p.length i p.length p p.length i++ i++ i {
			p[i] = sc.nextInt();
		} {
			p[i] = sc.nextInt();
		} p[i] = sc.nextInt() p[i] p i sc.nextInt() sc.nextInt sc if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		} n==1 n 1 {
		} if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		} p[0]>p[1] p[0] p 0 p[1] p 1 {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		} p[0] -- p[0] p 0 if (p[0]>p[1]) {
				pd = false;
			} p[0]>p[1] p[0] p 0 p[1] p 1 {
				pd = false;
			} pd = false pd false for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		} int i = 1; int i = 1; i 1 i < p.length-1 i p.length-1 p.length p p.length 1 i++ i++ i {
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		} {
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		} if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			} p[i]>p[i+1] p[i] p i p[i+1] p i+1 i 1 {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} p[i]-- p[i] p i if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				} p[i]>p[i+1]||p[i]<p[i-1] p[i]>p[i+1] p[i] p i p[i+1] p i+1 i 1 p[i]<p[i-1] p[i] p i p[i-1] p i-1 i 1 {
					pd = false;
					break;
				} pd = false pd false break; {
				if(p[i]>p[i-1])
					p[i]--;
			} if(p[i]>p[i-1])
					p[i]--; p[i]>p[i-1] p[i] p i p[i-1] p i-1 i 1 p[i]-- p[i] p i if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} pd {
			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" 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();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		boolean pd = true;
		for (int i = 0; i < p.length; i++){
			p[i] = sc.nextInt();
		}
		if (n==1) {
		} else if (p[0]>p[1]) {
			p[0] --;
			if (p[0]>p[1]) {
				pd = false;
			}
		}
		for (int i = 1; i < p.length-1; i++){
			if (p[i]>p[i+1]) {
				p[i]--;
				if (p[i]>p[i+1]||p[i]<p[i-1]){
					pd = false;
					break;
				}
			} else {
				if(p[i]>p[i-1])
					p[i]--;
			}
		}
		if (pd) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}
}