N = gets.chomp.to_i
h_arr = gets.chomp.split(' ').map(&:to_i)

prev = 0
count = 0
ret = 'Yes'

h_arr.each do |i|
  if i >= prev
    prev = i
  elsif i < prev
    if (prev - i) >= 2
      ret = 'No'
      break
    end

    if count == 1
      ret = 'No'
      break
    end
    count += 1
    prev = i
  end
end

print ret
