N = gets.to_i
if N == 1
    print 'Yes'
else
    h = gets.split(" ").map(&:to_i);
    s = Array.new
    (N-1).downto(1) do |i|
        if h[i] < h[i-1]
            s.push(h[i], h[i-1])
        end
    end
    if s.length >= 3
        print 'No'
    elsif s[1]-s[0] >= 2
        print 'No'
    else
        print 'Yes'
    end
end

