n = gets.chomp.to_i
ary = gets.chomp.split().map(&:to_i)

idx = 0
diff_ary = []
(ary.size - 1).times do |i|
  if ary[i+1] - ary[i] != 0
    diff_ary << [ary[i+1] - ary[i],idx]
    idx += 1
  end
end

if diff_ary.any?{|diff| diff.first < -1}
  puts "No"
else
  # 最初のifで-2以下のdiffは無くなっている。
  m_a = minus_diff_ary_idx = diff_ary.select{|diff| diff.first == -1}.map(&:last)
  if (m_a.size-1).times.any? do |m_idx|
      m_a[m_idx+1] - m_a[m_idx] == 1
    end
    puts "No"
  else
    puts "Yes"
  end
end