import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val Array(a,b) = readLine.split(" ").map(_.toInt)
  val ps = readLine.split(" ").map(_.toInt)

  val problem1 = ps.filter(p => p <= a)
  val problem2 = ps.filter(p => a+1 <= p && p <= b)
  val problem3 = ps.filter(p => b+1 <= p)

  val result = Seq(problem1, problem2, problem3).map(_.length).min
  println(result)
}