n = gets.to_i
arr = gets.to_s.split(' ')
arr = arr.map(&:to_i)

bool = 'Yes'

if arr.size == 2
  if arr[0] <= arr[1]
    puts 'Yes'
  else
    puts 'No'
  end
else
  (2...n).each do |i|
    bool = 'No' if arr[i - 2] - 1 > arr[i - 1]
    bool = 'No' if arr[i - 1] - 1 > arr[i]

    # check for ex array, e.g. [4, 3, 3, 3, 2]
    tmp = i
    tmp += 1 while arr[i] == arr[tmp]
    if arr[i - 1] - 1 == arr[tmp - 1] && arr[tmp - 1] - 1 == arr[tmp]
      bool = 'No' if arr[i - 1] - arr[tmp] == 2
    end
  end

  # (1...n).each do |i|
  #   # check for ex array, e.g. [4, 3, 3, 3, 2]
  #   tmp = i
  #   tmp += 1 while arr[i] == arr[tmp]
  #   if arr[i - 1] - 1 == arr[tmp - 1] && arr[tmp - 1] - 1 == arr[tmp]
  #     bool = 'No' if arr[i - 1] - arr[tmp] == 2
  #   end
  # end
  puts bool
end
