import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] h = new int[n]; h new int[n] n int pre = n-1; pre n-1 n 1 boolean yes = true; yes true for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            h[i] = scanner.nextInt();
        } {
            h[i] = scanner.nextInt();
        } h[i] = scanner.nextInt() h[i] h i scanner.nextInt() scanner.nextInt scanner for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        } int i = n-2; int i = n-2; i n-2 n 2 i >= 0 i 0 i-- i-- i {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        } {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        } if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            } h[i] - h[pre] == 1 h[i] - h[pre] h[i] h i h[pre] h pre 1 {
                h[i]--;
            } h[i]-- h[i] h i if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            } h[i] - h[pre] > 1 h[i] - h[pre] h[i] h i h[pre] h pre 1 {
                yes = false;
                break;
            } yes = false yes false break; pre-- pre if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } yes {
            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" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] h = new int[n];
        int pre = n-1;
        boolean yes = true;

        for (int i = 0; i < n; i++) {
            h[i] = scanner.nextInt();
        }
        for (int i = n-2; i >= 0 ; i--) {
            if(h[i] - h[pre] == 1) {
                h[i]--;
            } else if(h[i] - h[pre] > 1) {
                yes = false;
                break;
            }
            pre--;
        }

        if(yes){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

