import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import java.io.BufferedReader;
import java.io.FileReader;

public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	}
		
}	
	
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}
	
	public Scanner (String file) throws IOException{
        br=new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}


}
 import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.BufferedReader; BufferedReader java.io import java.io.FileReader; FileReader java.io public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	}
		
} Main public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	} main {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n= sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			a[i]= sc.nextInt(); 
		} {
			a[i]= sc.nextInt(); 
		} a[i]= sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc boolean possibe = true; possibe true for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		} int i = 0; int i = 0; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		} {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		} if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			} a[i] > a[i+1] a[i] a i a[i+1] a i+1 i 1 {
				a[i]--;
			} a[i]-- a[i] a i {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			} if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				} i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1] i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1] i > 0 i 0 a[i-1] <= a[i]-1 a[i-1] a i-1 i 1 a[i]-1 a[i] a i 1 a[i] == a[i+1] a[i] a i a[i+1] a i+1 i 1 {
					a[i]--;
				} a[i]-- a[i] a i for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		} int i = 0; int i = 0; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		} {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		} if (a[i] > a[i+1]) {
				possibe = false;
			} a[i] > a[i+1] a[i] a i a[i+1] a i+1 i 1 {
				possibe = false;
			} possibe = false possibe false if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		} possibe {
			out.print("Yes");
		} out.print("Yes") out.print out "Yes" {
			out.print("No");
		} out.print("No") out.print out "No" out.flush() out.flush out String[] args args class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}
	
	public Scanner (String file) throws IOException{
        br=new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}


} Scanner StringTokenizer st; st BufferedReader br; br public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	} Scanner {
		br = new BufferedReader(new InputStreamReader(system));
	} br = new BufferedReader(new InputStreamReader(system)) br new BufferedReader(new InputStreamReader(system)) InputStream system system public Scanner (String file) throws IOException{
        br=new BufferedReader(new FileReader(file));
	} Scanner {
        br=new BufferedReader(new FileReader(file));
	} br=new BufferedReader(new FileReader(file)) br new BufferedReader(new FileReader(file)) String file file public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	} next {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	} while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public String nextLine() throws IOException {
		return br.readLine();
	} nextLine {
		return br.readLine();
	} return br.readLine(); br.readLine() br.readLine br public int nextInt() throws IOException {
		return Integer.parseInt(next());
	} nextInt {
		return Integer.parseInt(next());
	} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	} nextDouble {
		return Double.parseDouble(next());
	} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public char nextChar() throws IOException {
		return next().charAt(0);
	} nextChar {
		return next().charAt(0);
	} return next().charAt(0); next().charAt(0) next().charAt next() next 0 public Long nextLong() throws IOException {
		return Long.parseLong(next());
	} nextLong {
		return Long.parseLong(next());
	} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public boolean ready() throws IOException {
		return br.ready();
	} ready {
		return br.ready();
	} return br.ready(); br.ready() br.ready br public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	} waitForInput {
		Thread.sleep(3000);
	} Thread.sleep(3000) Thread.sleep Thread 3000 public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	}
		
} public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	}
		
} Main
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import java.io.BufferedReader;
import java.io.FileReader;

public class Main{
	
	public static void main(String[] args) throws IOException, InterruptedException {
		
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n= sc.nextInt();
		
		int[] a = new int[n];
		
		for (int i = 0; i < a.length; i++) {
			a[i]= sc.nextInt(); 
		}
		boolean possibe = true;
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				a[i]--;
			}
			else {
				if (i > 0 && a[i-1] <= a[i]-1 && a[i] == a[i+1]) {
					a[i]--;
				}
			}
		}
		
		for (int i = 0; i < a.length-1; i++) {
			if (a[i] > a[i+1]) {
				possibe = false;
			}
		}
		
		if (possibe) {
			out.print("Yes");
		}
		else {
			out.print("No");
		}
		
		out.flush();
	}
		
}	
	
class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream system) {
		br = new BufferedReader(new InputStreamReader(system));
	}
	
	public Scanner (String file) throws IOException{
        br=new BufferedReader(new FileReader(file));
	}

	public String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public String nextLine() throws IOException {
		return br.readLine();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public char nextChar() throws IOException {
		return next().charAt(0);
	}

	public Long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	public boolean ready() throws IOException {
		return br.ready();
	}

	public void waitForInput() throws InterruptedException {
		Thread.sleep(3000);
	}


}

