n = gets.chomp.to_i
h = gets.chomp.split(" ").map(&:to_i)
count = 0

for i in 0..(n-3) do
  if (h[i] > h[i+1]) 
    if h[i] - h[i+1] > 1 
      if h[i] <= h[i+1]  and h[i+1] <= h[i+2]
        count += 1
      end
    end
  end
end
  

if count < 1
  puts "Yes"
else
  puts "No"
end