object Main extends App {
  var n = readInt
  var Hs = readLine.split(" ").map(_.toInt)
  var mins = Hs.scanRight(1000000007)(math.min(_,_))
  print(if(Range(0, n).map{t => if(Hs(t)-mins(t) > 1) 1 else 0}.sum > 0) "No" else "Yes")
}