n = gets.to_i
h = gets.split.map(&:to_i)
possible = true
operated = false
for i in 1...n do
  if h[i] - h[i - 1] == -1
    if operated
      possible = false
      break
    else
      operated = true
    end
  elsif h[i] - h[i - 1] < -1
    possible = false
    break
  else
    operated = false
  end
end
puts possible ? "Yes" : "No"
