import java.util.*;

class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        }

        String answer = "Yes";
        for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        }
        System.out.println(answer);
    }
} import java.util.*; util.* java class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        }

        String answer = "Yes";
        for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        }
        System.out.println(answer);
    }
} Main public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        }

        String answer = "Yes";
        for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        }
        System.out.println(answer);
    } main {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        }

        String answer = "Yes";
        for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        }
        System.out.println(answer);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        } int i = n-1; int i = n-1; i n-1 n 1 i >= 0 i 0 i-- i-- i {
            arr[i] = sc.nextInt();
        } {
            arr[i] = sc.nextInt();
        } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc String answer = "Yes"; answer "Yes" for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        } {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        } int diff = arr[i] - arr[i-1]; diff arr[i] - arr[i-1] arr[i] arr i arr[i-1] arr i-1 i 1 if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            } diff > 1 diff 1 {
                answer = "No";
                break;
            } answer = "No" answer "No" break; if (diff == 1) {
                arr[i]--;
            } diff == 1 diff 1 {
                arr[i]--;
            } arr[i]-- arr[i] arr i System.out.println(answer) System.out.println System.out System System.out answer String[] args args
import java.util.*;

class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = n-1; i >= 0; i--) {
            arr[i] = sc.nextInt();
        }

        String answer = "Yes";
        for (int i = 1; i < n; i++) {
            int diff = arr[i] - arr[i-1];
            if (diff > 1) {
                answer = "No";
                break;
            } else if (diff == 1) {
                arr[i]--;
            }
        }
        System.out.println(answer);
    }
}