import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    } main {
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter ou = new PrintWriter(System.out); ou new PrintWriter(System.out) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] h = new int[n]; h new int[n] n for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			h[i] = Integer.parseInt(sc.next());
		} {
			h[i] = Integer.parseInt(sc.next());
		} h[i] = Integer.parseInt(sc.next()) h[i] h i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		} int i = n - 2 ; int i = n - 2 ; i n - 2 n 2 i >= 0 i 0 i-- i-- i {
			if(h[i] > h[i + 1]) h[i]--;
		} {
			if(h[i] > h[i + 1]) h[i]--;
		} if(h[i] > h[i + 1]) h[i]--; h[i] > h[i + 1] h[i] h i h[i + 1] h i + 1 i 1 h[i]-- h[i] h i boolean ebishu = true; ebishu true for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		} int i = 1 ; int i = 1 ; i 1 ebishu && i < n ebishu i < n i n i++ i++ i {
			if(h[i - 1] > h[i]) ebishu = false;
		} {
			if(h[i - 1] > h[i]) ebishu = false;
		} if(h[i - 1] > h[i]) ebishu = false; h[i - 1] > h[i] h[i - 1] h i - 1 i 1 h[i] h i ebishu = false ebishu false if(ebishu) ou.print("Yes\n");
		else ou.print("No\n"); ebishu ou.print("Yes\n") ou.print ou "Yes\n" ou.print("No\n") ou.print ou "No\n" ou.flush() ou.flush ou String[] args args public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    }
} public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    }
} Main
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int[] h = new int[n];
		for(int i = 0 ; i < n ; i++){
			h[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		for(int i = n - 2 ; i >= 0 ; i--){
			if(h[i] > h[i + 1]) h[i]--;
		}
		boolean ebishu = true;
		for(int i = 1 ; ebishu && i < n ; i++){
			if(h[i - 1] > h[i]) ebishu = false;
		}
		if(ebishu) ou.print("Yes\n");
		else ou.print("No\n");
		ou.flush();
    }
}