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

res = 'Yes'
i = 0
cnt = 0
while i + 1 < n
  if (arr[i] - arr[i+1]) == 1
    cnt += 1
  elsif arr[i] - arr[i+1] >= 2
    res = 'No'
    break
  end

  i += 1
  if cnt >= 2
    res = 'No'
    break
  end
end

puts(res)
