import java.io.*;

/**
 * Created by Ayushi on 04/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
} import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    } main {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    } BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) String[] temp = r.readLine().split(" "); temp r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int n = Integer.parseInt(temp[0]); n Integer.parseInt(temp[0]) Integer.parseInt Integer temp[0] temp 0 temp = r.readLine().split(" ") temp r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " r.close() r.close r boolean ans = true; ans true int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = Integer.parseInt(temp[i]);
        } {
            s[i] = Integer.parseInt(temp[i]);
        } s[i] = Integer.parseInt(temp[i]) s[i] s i Integer.parseInt(temp[i]) Integer.parseInt Integer temp[i] temp i s[0]-- s[0] s 0 for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        } int k = 1; int k = 1; k 1 k < n k n k++ k++ k {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        } {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        } if (s[k] > s[k-1]) s[k]--; s[k] > s[k-1] s[k] s k s[k-1] s k-1 k 1 s[k]-- s[k] s k if (s[k-1] > s[k]) {
                ans = false;
                break;
            } s[k-1] > s[k] s[k-1] s k-1 k 1 s[k] s k {
                ans = false;
                break;
            } ans = false ans false break; System.out.println(ans ? "Yes":"No") System.out.println System.out System System.out ans ? "Yes":"No" ans "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
} Main
import java.io.*;

/**
 * Created by Ayushi on 04/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        temp = r.readLine().split(" ");
        r.close();
        boolean ans = true;
        int[] s = new int[n];
        for (int i = 0; i < n; i++) {
            s[i] = Integer.parseInt(temp[i]);
        }
        s[0]--;
        for (int k = 1; k < n; k++) {
            if (s[k] > s[k-1]) s[k]--;
            if (s[k-1] > s[k]) {
                ans = false;
                break;
            }
        }
        System.out.println(ans ? "Yes":"No");
    }
}
