n=gets.chop.to_i
array=gets.chomp.split(" ").map(&:to_i)
a='No' 
num=0
num2=0
if n==1
    a='Yes'
end
if array[0]<array[n-1]
 for i in 0...n-1 do
  if array[i]<=array[i+1]
   num+=num
   end
  if array[i+1]-array[i]<=1
   num2+=num2
   end
  end
  if num==n&&num2==n
a='Yes'
  end
end

puts a