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

bool = 'Yes'

if arr.size == 2
  if arr[0] <= arr[1]
    puts 'Yes'
  else
    puts 'No'
  end
else
  i = 1
  while i < n
    prev = arr[i - 1]
    now = arr[i]

    bool = 'No' if prev - 1 > now

    # 4 3 3 3 2 みたいなパターンの検出
    while now == arr[i + 1]
      i += 1
    end

    if prev - 1 == now && now - 1 == arr[i + 1]
      bool = 'No' if (prev - arr[i + 1] == 2)
    end
    i += 1
  end
  puts bool
end
