object Main extends App {
  val N: Int = io.StdIn.readInt() - 1

  val A: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sortWith(_ < _)
  val B: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sortWith(_ > _)
  val C: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sortWith(_ > _)

  def ARec(i: Int, largerCount: Int): Int = {
    if (i > N) largerCount else ARec(i + 1, BRec(0, largerCount, A(i)))
  }

  def BRec(i: Int, largerCount: Int, compared: Int): Int = {
    if (i > N || compared >= B(i)) {
      largerCount
    } else {
      val count = CRec(0, largerCount, B(i))
      BRec(i + 1, count, compared)
    }
  }

  def CRec(i: Int, largerCount: Int, compared: Int): Int = {
    if (i > N || compared >= C(i)) {
      largerCount
    } else {
      CRec(i + 1, largerCount + 1, compared)
    }
  }

  println(ARec(0, 0))
}