n=io.read("*n")
a={-2}
for i=1,n do
  table.insert(a,io.read("*n"))
end

for i=2,n+1 do
  if a[i-1]>a[i] then
    if a[i-1]>a[i]+1 then
      print("No")
      os.exit()
    else
      a[i]=a[i]+1
    end
  end
end

print("Yes")