import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            list.add(Integer.parseInt(sc.next()));
        } {
            list.add(Integer.parseInt(sc.next()));
        } list.add(Integer.parseInt(sc.next())) list.add list Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        } int i = list.size() - 1; int i = list.size() - 1; i list.size() - 1 list.size() list.size list 1 i > 0 i 0 i-- i-- i {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        } {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        } if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            } list.get(i) - list.get(i - 1) < -1 list.get(i) - list.get(i - 1) list.get(i) list.get list i list.get(i - 1) list.get list i - 1 i 1 -1 1 {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            } list.get(i) - list.get(i - 1) < 0 list.get(i) - list.get(i - 1) list.get(i) list.get list i list.get(i - 1) list.get list i - 1 i 1 0 {
                list.set(i - 1, list.get(i - 1) - 1);
            } list.set(i - 1, list.get(i - 1) - 1) list.set list i - 1 i 1 list.get(i - 1) - 1 list.get(i - 1) list.get list i - 1 i 1 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(Integer.parseInt(sc.next()));
        }
        for (int i = list.size() - 1; i > 0; i--) {
            if (list.get(i) - list.get(i - 1) < -1) {
                System.out.println("No");
                return;
            } else if (list.get(i) - list.get(i - 1) < 0) {
                list.set(i - 1, list.get(i - 1) - 1);
            }
        }
        System.out.println("Yes");
        sc.close();
    }
}