#!/bin/env ruby
#

s = STDIN.readlines

n = s[0].to_i
h = s[1].split(" ").map(&:to_i)

is_decrease = 0

0.upto(h.size - 2) do |i|
  if (h[i] - h[i+1]) > 1
    puts "No"
    exit
  end
  if (h[i] - h[i+1]) == 1
    is_decrease = is_decrease + 1
    if is_decrease == 2
      puts "No"
      exit
    end
  end
end

puts "Yes"
