import std.stdio, std.conv, std.string, std.array, std.algorithm,
    std.numeric, std.math, std.range;

void main()
{
    long n;
    readf("%d\n", &n);
    auto hs = readln.strip.split.to!(long[]);

    foreach_reverse (i; 1 .. hs.length)
    {
        if (hs[i] < hs[i - 1])
        {
            if (hs[i] + 1 == hs[i - 1])
            {
                hs[i - 1]--;
            }
            else
            {
                writeln("No");
                return;
            }
        }
    }
    writeln("Yes");
}
