import scala.io.StdIn
import scala.annotation.tailrec

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

  val arr = Array.ofDim[Int](3)
  p.foreach(i => {
    if(i <= a) arr(0) += 1
    else if(i <= b) arr(1) += 1
    else arr(2) += 1
  })

  val ans = arr.min
  println(ans)
}