import std.stdio, std.string, std.array, std.conv;

void main() {
    int n = readln.chomp.to!int;
    int[] h = readln.split.to!(int[]);
    bool ok = true;
    int cnt = 1;
    foreach (i; 1 .. n) {
        if (h[i] > h[i-1]) {
            ++cnt;
        } else if (h[i] < h[i-1]) {
            if (h[i-1] - h[i] > cnt) ok = false;
            cnt = 0;
        }
    }
    writeln(ok ? "Yes" : "No");
}