import java.io.PrintWriter;
import java.util.*;

public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	}
}

 import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	}
} Main public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	} main {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	} Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int N = Integer.parseInt(stdin.next()); N Integer.parseInt(stdin.next()) Integer.parseInt Integer stdin.next() stdin.next stdin int H[] = new int[N]; H new int[N] N int flag; flag if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			} N==1 N 1 {
				flag=1;
			} flag=1 flag 1 {
				flag=0;
			} flag=0 flag 0 for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {
				H[i] = Integer.parseInt(stdin.next());
			} {
				H[i] = Integer.parseInt(stdin.next());
			} H[i] = Integer.parseInt(stdin.next()) H[i] H i Integer.parseInt(stdin.next()) Integer.parseInt Integer stdin.next() stdin.next stdin for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			} int i=N-1; int i=N-1; i N-1 N 1 i>0 i 0 i-- i-- i {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			} {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			} if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				} H[i-1]-H[i] > 1 H[i-1]-H[i] H[i-1] H i-1 i 1 H[i] H i 1 {
					flag=0;
					break;
				} flag=0 flag 0 break; if(H[i] < H[i-1]){
					H[i-1] -= 1;
				} H[i] < H[i-1] H[i] H i H[i-1] H i-1 i 1 {
					H[i-1] -= 1;
				} H[i-1] -= 1 H[i-1] H i-1 i 1 1 for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			} {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			} if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				} H[i] <= H[i+1] H[i] H i H[i+1] H i+1 i 1 {
					flag =1;
				} flag =1 flag 1 {
					flag=0;
					break;
				} flag=0 flag 0 break; if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			} flag==1 flag 1 {
				out.println("Yes");
			} out.println("Yes") out.println out "Yes" {
				out.println("No");
			} out.println("No") out.println out "No" out.flush() out.flush out String[] args args public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	}
} public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	}
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {
		public static void main(String[] args) {
			Scanner stdin = new Scanner(System.in);
			PrintWriter out = new PrintWriter(System.out);
			
			int N = Integer.parseInt(stdin.next());
			int H[] = new int[N];
			int flag;
			if(N==1) {
				flag=1;
			}
			else {
				flag=0;
			}
			
			for(int i=0;i<N;i++) {
				H[i] = Integer.parseInt(stdin.next());
			}
			
			for(int i=N-1;i>0;i--) {
				if(H[i-1]-H[i] > 1) {
					flag=0;
					break;
				}
				else if(H[i] < H[i-1]){
					H[i-1] -= 1;
				}
			}

			
			for(int i=0;i<N-1;i++) {
				if(H[i] <= H[i+1]) {
					flag =1;
				}
				else {
					flag=0;
					break;
				}
			}
				
			if(flag==1) {
				out.println("Yes");
			}
			else {
				out.println("No");
			}
			
			out.flush();
	}
}


