import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class Main {


	public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    }

    private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    }

    private void print(int []array) {
        System.out.println(Arrays.toString(array));
    }
  
   

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
 

	public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	}


    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);
	 
    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

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

class XCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.x == p2.x) return p1.y - p2.y;
        return p1.x-p2.x;
    }

}
class YCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.y == p2.y) return p1.x - p2.x;
        return p1.y-p2.y;
    }

}
class Point{
    int x,y;
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
    public String toString(){
        return "("+x+","+y+")";
    }

    public int hashCode(){
        String s = x+""+y;
        return s.hashCode();
    }
    @Override
    public boolean equals(Object obj){
        Point p = (Point) obj;         
        return this.x == p.x && this.y == p.y;
    }
}
class DNode{
    int val;
    int index;
    DNode next,prev;
    public DNode(int val, int index){
        this.val = val;
        this.index = index;
    }
    public boolean equals(Object o){
        if (!(o instanceof DNode)){
            return false;
        }
        DNode other = (DNode)o;
        return (other.val==this.val) && (other.index == this.index);

    }

    public String toString() {
        return this.index + " -> " + this.val;
    }
}
class DList{

    DNode tail,head;
    int count;

    public DList() {
        tail = new DNode(-1,-1);         
        head = new DNode(-2,-2);
        head.next = tail;
        head.prev = tail;
        tail.prev = head;
        tail.next = head;
        count =0;
    }
    public void add(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addNode(curr);
    }
    public void addLast(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addLast(curr);
    }

    private void addNode(DNode curr) {
        DNode temp = head.next;
        head.next = curr;
        curr.prev = head;

        curr.next = temp;
        temp.prev = curr;
    }

    private void addLast(DNode curr) {
        DNode temp = tail.prev;
        tail.prev = curr;
        curr.next = tail;

        curr.prev = temp;
        temp.next = curr;
    }

    public boolean hasNext(){
        return !head.next.equals(tail);
    }
    public DNode remove() {
        count--;
        DNode temp = head.next;
        DNode nextNode = temp.next;
        head.next = nextNode;
        nextNode.prev = head;
        return temp;
    }
    
    public int size(){
        return count;
    }

    public void printNodes() {
        DNode curr = head.next;
        while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        }
        System.out.println("NULL");
    }


} import java.io.*; io.* java import java.util.*; util.* java import java.math.BigInteger; BigInteger java.math public class Main {


	public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    }

    private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    }

    private void print(int []array) {
        System.out.println(Arrays.toString(array));
    }
  
   

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
 

	public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	}


    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);
	 
    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

        public long nextLong(){
            return Long.parseLong(next());
        }
    }
} Main private static InputStream inputStream = System.in; inputStream System.in System System.in private static InputReader input = new InputReader(inputStream); input new InputReader(inputStream) private static OutputStream outputStream = System.out; outputStream System.out System System.out private static PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    } readInput {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    } int N = input.nextInt(); N input.nextInt() input.nextInt input int [] array = new int[N]; array new int[N] N for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            array[i] = input.nextInt();
        } {
            array[i] = input.nextInt();
        } array[i] = input.nextInt() array[i] array i input.nextInt() input.nextInt input for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        } int i=N-1; int i=N-1; i N-1 N 1 i>0 i 0 i-- i-- i {
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        } {
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        } int curr = array[i]; curr array[i] array i int prev = array[i-1]; prev array[i-1] array i-1 i 1 if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            } (prev-curr) < 1 (prev-curr) prev curr 1 continue; if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            } (prev-curr)==1 (prev-curr) prev curr 1 {
                array[i-1]--;
                continue;
            } array[i-1]-- array[i-1] array i-1 i 1 continue; {
                System.out.printf("No\n");
                return;
            } System.out.printf("No\n") System.out.printf System.out System System.out "No\n" return; System.out.printf("Yes\n") System.out.printf System.out System System.out "Yes\n" private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    } print {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    } for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        } int i=0; int i=0; i 0 i<matrix.length i matrix.length matrix matrix.length i++ i++ i {
            System.out.println(Arrays.toString(matrix[i]));
        } {
            System.out.println(Arrays.toString(matrix[i]));
        } System.out.println(Arrays.toString(matrix[i])) System.out.println System.out System System.out Arrays.toString(matrix[i]) Arrays.toString Arrays matrix[i] matrix i System.out.println() System.out.println System.out System System.out int[][] matrix matrix private void print(int []array) {
        System.out.println(Arrays.toString(array));
    } print {
        System.out.println(Arrays.toString(array));
    } System.out.println(Arrays.toString(array)) System.out.println System.out System System.out Arrays.toString(array) Arrays.toString Arrays array int []array array private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    } swap {
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    } char temp = array[i]; temp array[i] array i array[i] = array[j] array[i] array i array[j] array j array[j] = temp array[j] array j temp char []array array int i i int j j public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	} main {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	} Main ans = new Main(); ans new Main() ans.readInput() ans.readInput ans out.close() out.close out String[] args args static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

        public long nextLong(){
            return Long.parseLong(next());
        }
    } InputReader private BufferedReader buf; buf private StringTokenizer token; token public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        } InputReader {
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        } buf = new BufferedReader(new InputStreamReader(inputStream),32768) buf new BufferedReader(new InputStreamReader(inputStream),32768) token = null token null InputStream inputStream inputStream private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        } next {
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        } while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            } token==null || !token.hasMoreTokens() token==null token null !token.hasMoreTokens() token.hasMoreTokens() token.hasMoreTokens token {
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            } try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                } catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                } Exception e {
                    throw new RuntimeException("Error in reading input",e);
                } throw new RuntimeException("Error in reading input",e); new RuntimeException("Error in reading input",e) {
                    token = new StringTokenizer(buf.readLine());
                } token = new StringTokenizer(buf.readLine()) token new StringTokenizer(buf.readLine()) return token.nextToken(); token.nextToken() token.nextToken token public int nextInt(){
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public String nextString(){
            return next();
        } nextString {
            return next();
        } return next(); next() next public long nextLong(){
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next class XCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.x == p2.x) return p1.y - p2.y;
        return p1.x-p2.x;
    }

} XCoordinateComparator public int compare(Point p1, Point p2){
        if (p1.x == p2.x) return p1.y - p2.y;
        return p1.x-p2.x;
    } compare {
        if (p1.x == p2.x) return p1.y - p2.y;
        return p1.x-p2.x;
    } if (p1.x == p2.x) return p1.y - p2.y; p1.x == p2.x p1.x p1 p1.x p2.x p2 p2.x return p1.y - p2.y; p1.y - p2.y p1.y p1 p1.y p2.y p2 p2.y return p1.x-p2.x; p1.x-p2.x p1.x p1 p1.x p2.x p2 p2.x Point p1 p1 Point p2 p2 Comparator class YCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.y == p2.y) return p1.x - p2.x;
        return p1.y-p2.y;
    }

} YCoordinateComparator public int compare(Point p1, Point p2){
        if (p1.y == p2.y) return p1.x - p2.x;
        return p1.y-p2.y;
    } compare {
        if (p1.y == p2.y) return p1.x - p2.x;
        return p1.y-p2.y;
    } if (p1.y == p2.y) return p1.x - p2.x; p1.y == p2.y p1.y p1 p1.y p2.y p2 p2.y return p1.x - p2.x; p1.x - p2.x p1.x p1 p1.x p2.x p2 p2.x return p1.y-p2.y; p1.y-p2.y p1.y p1 p1.y p2.y p2 p2.y Point p1 p1 Point p2 p2 Comparator class Point{
    int x,y;
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
    public String toString(){
        return "("+x+","+y+")";
    }

    public int hashCode(){
        String s = x+""+y;
        return s.hashCode();
    }
    @Override
    public boolean equals(Object obj){
        Point p = (Point) obj;         
        return this.x == p.x && this.y == p.y;
    }
} Point int x x y; y public Point(int x, int y){
        this.x = x;
        this.y = y;
    } Point {
        this.x = x;
        this.y = y;
    } this.x = x this.x this this.x x this.y = y this.y this this.y y int x x int y y public String toString(){
        return "("+x+","+y+")";
    } toString {
        return "("+x+","+y+")";
    } return "("+x+","+y+")"; "("+x+","+y+")" y "," "("+x+","+y+")" "(" x "," y ")" public int hashCode(){
        String s = x+""+y;
        return s.hashCode();
    } hashCode {
        String s = x+""+y;
        return s.hashCode();
    } String s = x+""+y; s x+""+y x+""+y x "" y return s.hashCode(); s.hashCode() s.hashCode s @Override
    public boolean equals(Object obj){
        Point p = (Point) obj;         
        return this.x == p.x && this.y == p.y;
    } equals {
        Point p = (Point) obj;         
        return this.x == p.x && this.y == p.y;
    } Point p = (Point) obj; p (Point) obj return this.x == p.x && this.y == p.y; this.x == p.x && this.y == p.y this.x == p.x this.x this this.x p.x p p.x this.y == p.y this.y this this.y p.y p p.y Object obj obj class DNode{
    int val;
    int index;
    DNode next,prev;
    public DNode(int val, int index){
        this.val = val;
        this.index = index;
    }
    public boolean equals(Object o){
        if (!(o instanceof DNode)){
            return false;
        }
        DNode other = (DNode)o;
        return (other.val==this.val) && (other.index == this.index);

    }

    public String toString() {
        return this.index + " -> " + this.val;
    }
} DNode int val; val int index; index DNode next next prev; prev public DNode(int val, int index){
        this.val = val;
        this.index = index;
    } DNode {
        this.val = val;
        this.index = index;
    } this.val = val this.val this this.val val this.index = index this.index this this.index index int val val int index index public boolean equals(Object o){
        if (!(o instanceof DNode)){
            return false;
        }
        DNode other = (DNode)o;
        return (other.val==this.val) && (other.index == this.index);

    } equals {
        if (!(o instanceof DNode)){
            return false;
        }
        DNode other = (DNode)o;
        return (other.val==this.val) && (other.index == this.index);

    } if (!(o instanceof DNode)){
            return false;
        } !(o instanceof DNode) (o instanceof DNode) o DNode {
            return false;
        } return false; false DNode other = (DNode)o; other (DNode)o return (other.val==this.val) && (other.index == this.index); (other.val==this.val) && (other.index == this.index) (other.val==this.val) other.val other other.val this.val this this.val (other.index == this.index) other.index other other.index this.index this this.index Object o o public String toString() {
        return this.index + " -> " + this.val;
    } toString {
        return this.index + " -> " + this.val;
    } return this.index + " -> " + this.val; this.index + " -> " + this.val this.index + " -> " + this.val this.index this this.index " -> " this.val this this.val class DList{

    DNode tail,head;
    int count;

    public DList() {
        tail = new DNode(-1,-1);         
        head = new DNode(-2,-2);
        head.next = tail;
        head.prev = tail;
        tail.prev = head;
        tail.next = head;
        count =0;
    }
    public void add(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addNode(curr);
    }
    public void addLast(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addLast(curr);
    }

    private void addNode(DNode curr) {
        DNode temp = head.next;
        head.next = curr;
        curr.prev = head;

        curr.next = temp;
        temp.prev = curr;
    }

    private void addLast(DNode curr) {
        DNode temp = tail.prev;
        tail.prev = curr;
        curr.next = tail;

        curr.prev = temp;
        temp.next = curr;
    }

    public boolean hasNext(){
        return !head.next.equals(tail);
    }
    public DNode remove() {
        count--;
        DNode temp = head.next;
        DNode nextNode = temp.next;
        head.next = nextNode;
        nextNode.prev = head;
        return temp;
    }
    
    public int size(){
        return count;
    }

    public void printNodes() {
        DNode curr = head.next;
        while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        }
        System.out.println("NULL");
    }


} DList DNode tail tail head; head int count; count public DList() {
        tail = new DNode(-1,-1);         
        head = new DNode(-2,-2);
        head.next = tail;
        head.prev = tail;
        tail.prev = head;
        tail.next = head;
        count =0;
    } DList {
        tail = new DNode(-1,-1);         
        head = new DNode(-2,-2);
        head.next = tail;
        head.prev = tail;
        tail.prev = head;
        tail.next = head;
        count =0;
    } tail = new DNode(-1,-1) tail new DNode(-1,-1) head = new DNode(-2,-2) head new DNode(-2,-2) head.next = tail head.next head head.next tail head.prev = tail head.prev head head.prev tail tail.prev = head tail.prev tail tail.prev head tail.next = head tail.next tail tail.next head count =0 count 0 public void add(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addNode(curr);
    } add {
        DNode curr = new DNode(val, index);
        count++;
        addNode(curr);
    } DNode curr = new DNode(val, index); curr new DNode(val, index) count++ count addNode(curr) addNode curr int val val int index index public void addLast(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addLast(curr);
    } addLast {
        DNode curr = new DNode(val, index);
        count++;
        addLast(curr);
    } DNode curr = new DNode(val, index); curr new DNode(val, index) count++ count addLast(curr) addLast curr int val val int index index private void addNode(DNode curr) {
        DNode temp = head.next;
        head.next = curr;
        curr.prev = head;

        curr.next = temp;
        temp.prev = curr;
    } addNode {
        DNode temp = head.next;
        head.next = curr;
        curr.prev = head;

        curr.next = temp;
        temp.prev = curr;
    } DNode temp = head.next; temp head.next head head.next head.next = curr head.next head head.next curr curr.prev = head curr.prev curr curr.prev head curr.next = temp curr.next curr curr.next temp temp.prev = curr temp.prev temp temp.prev curr DNode curr curr private void addLast(DNode curr) {
        DNode temp = tail.prev;
        tail.prev = curr;
        curr.next = tail;

        curr.prev = temp;
        temp.next = curr;
    } addLast {
        DNode temp = tail.prev;
        tail.prev = curr;
        curr.next = tail;

        curr.prev = temp;
        temp.next = curr;
    } DNode temp = tail.prev; temp tail.prev tail tail.prev tail.prev = curr tail.prev tail tail.prev curr curr.next = tail curr.next curr curr.next tail curr.prev = temp curr.prev curr curr.prev temp temp.next = curr temp.next temp temp.next curr DNode curr curr public boolean hasNext(){
        return !head.next.equals(tail);
    } hasNext {
        return !head.next.equals(tail);
    } return !head.next.equals(tail); !head.next.equals(tail) head.next.equals(tail) head.next.equals head.next head head.next tail public DNode remove() {
        count--;
        DNode temp = head.next;
        DNode nextNode = temp.next;
        head.next = nextNode;
        nextNode.prev = head;
        return temp;
    } remove {
        count--;
        DNode temp = head.next;
        DNode nextNode = temp.next;
        head.next = nextNode;
        nextNode.prev = head;
        return temp;
    } count-- count DNode temp = head.next; temp head.next head head.next DNode nextNode = temp.next; nextNode temp.next temp temp.next head.next = nextNode head.next head head.next nextNode nextNode.prev = head nextNode.prev nextNode nextNode.prev head return temp; temp public int size(){
        return count;
    } size {
        return count;
    } return count; count public void printNodes() {
        DNode curr = head.next;
        while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        }
        System.out.println("NULL");
    } printNodes {
        DNode curr = head.next;
        while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        }
        System.out.println("NULL");
    } DNode curr = head.next; curr head.next head head.next while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        } !curr.equals(tail) curr.equals(tail) curr.equals curr tail {
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        } System.out.println(curr) System.out.println System.out System System.out curr curr = curr.next curr curr.next curr curr.next System.out.println("NULL") System.out.println System.out System System.out "NULL" public class Main {


	public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    }

    private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    }

    private void print(int []array) {
        System.out.println(Arrays.toString(array));
    }
  
   

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
 

	public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	}


    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);
	 
    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

        public long nextLong(){
            return Long.parseLong(next());
        }
    }
} public class Main {


	public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    }

    private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    }

    private void print(int []array) {
        System.out.println(Arrays.toString(array));
    }
  
   

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
 

	public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	}


    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);
	 
    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

        public long nextLong(){
            return Long.parseLong(next());
        }
    }
} Main
import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class Main {


	public void readInput() throws Exception {
 		  
 			 
 		//BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
 		//BufferedReader buf = new BufferedReader(new FileReader("input.txt"));         
        int N = input.nextInt();
        int [] array = new int[N];        
        for(int i=0;i<N;i++) {
            array[i] = input.nextInt();
        }
         
        for(int i=N-1;i>0;i--){
            int curr = array[i];
            int prev = array[i-1];
            //System.out.printf("prev: %d curr: %d\n",prev,curr);
            if ((prev-curr) < 1) continue;
            else if ((prev-curr)==1) {
                array[i-1]--;
                continue;
            }else {
                System.out.printf("No\n");
                return;
            }
        }
         
        System.out.printf("Yes\n");
     
 
    }

    private void print(int[][] matrix) {
        for(int i=0;i<matrix.length;i++){
            System.out.println(Arrays.toString(matrix[i]));
        }
        System.out.println();
    }

    private void print(int []array) {
        System.out.println(Arrays.toString(array));
    }
  
   

    private static void swap(char []array, int i, int j){
        char temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
 

	public static void main(String[] args) throws Exception {
		Main ans = new Main();
		ans.readInput(); 
        out.close();
		//shouldReturn10();
		
	}


    private static InputStream inputStream = System.in;
    private static InputReader input = new InputReader(inputStream);
    private static OutputStream outputStream = System.out;
    private static PrintWriter out = new PrintWriter(outputStream);
	 
    static class InputReader {
        private BufferedReader buf;
        private StringTokenizer token;
        public InputReader(InputStream inputStream){
            buf = new BufferedReader(new InputStreamReader(inputStream),32768);
            token = null;
        }
        
        private String next(){
            while(token==null || !token.hasMoreTokens()){
                try{
                    token = new StringTokenizer(buf.readLine());
                }catch(Exception e){
                    throw new RuntimeException("Error in reading input",e);
                }
            }
            return token.nextToken();
        }
        
        public int nextInt(){
            return Integer.parseInt(next());
        }

        public String nextString(){
            return next();
        }

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

class XCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.x == p2.x) return p1.y - p2.y;
        return p1.x-p2.x;
    }

}
class YCoordinateComparator implements Comparator<Point>{

    public int compare(Point p1, Point p2){
        if (p1.y == p2.y) return p1.x - p2.x;
        return p1.y-p2.y;
    }

}
class Point{
    int x,y;
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
    public String toString(){
        return "("+x+","+y+")";
    }

    public int hashCode(){
        String s = x+""+y;
        return s.hashCode();
    }
    @Override
    public boolean equals(Object obj){
        Point p = (Point) obj;         
        return this.x == p.x && this.y == p.y;
    }
}
class DNode{
    int val;
    int index;
    DNode next,prev;
    public DNode(int val, int index){
        this.val = val;
        this.index = index;
    }
    public boolean equals(Object o){
        if (!(o instanceof DNode)){
            return false;
        }
        DNode other = (DNode)o;
        return (other.val==this.val) && (other.index == this.index);

    }

    public String toString() {
        return this.index + " -> " + this.val;
    }
}
class DList{

    DNode tail,head;
    int count;

    public DList() {
        tail = new DNode(-1,-1);         
        head = new DNode(-2,-2);
        head.next = tail;
        head.prev = tail;
        tail.prev = head;
        tail.next = head;
        count =0;
    }
    public void add(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addNode(curr);
    }
    public void addLast(int val, int index){
        DNode curr = new DNode(val, index);
        count++;
        addLast(curr);
    }

    private void addNode(DNode curr) {
        DNode temp = head.next;
        head.next = curr;
        curr.prev = head;

        curr.next = temp;
        temp.prev = curr;
    }

    private void addLast(DNode curr) {
        DNode temp = tail.prev;
        tail.prev = curr;
        curr.next = tail;

        curr.prev = temp;
        temp.next = curr;
    }

    public boolean hasNext(){
        return !head.next.equals(tail);
    }
    public DNode remove() {
        count--;
        DNode temp = head.next;
        DNode nextNode = temp.next;
        head.next = nextNode;
        nextNode.prev = head;
        return temp;
    }
    
    public int size(){
        return count;
    }

    public void printNodes() {
        DNode curr = head.next;
        while(!curr.equals(tail)){
            System.out.println(curr);
            //System.out.print("->");
            curr = curr.next;
        }
        System.out.println("NULL");
    }


}