import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {
    val n = StdIn.readLine().toInt
    val Array(a, b) = StdIn.readLine().split(' ').map(_.toInt)
    val ps = StdIn.readLine().split(' ').toList.map(_.toInt)

    val difficultyCount = ps.foldLeft(Vector(0, 0, 0)){(acc, p) =>
      val i = if (p <= a) 0 else if (p <= b) 1 else 2
      acc.updated(i, acc(i) + 1)
    }
    val ans = difficultyCount.foldLeft(n)((acc, d) => acc min d)
    println(ans)
  }

}
