import java.util.Scanner

object Main extends App {

  val sc: Scanner = new Scanner(System.in)
  val n: Int = sc.nextInt()
  val ls: IndexedSeq[Int] = IndexedSeq.fill(n)(sc.nextInt())
  val kinds: Set[Int] = ls.toSet

  println(
    if ((ls.length % kinds.size == 0) && (kinds.size <= 3) && kinds.map(k => ls.count(_ == k)).size == 1) "Yes" else "No"
  )

}