object Main extends App {
  val N: Int = io.StdIn.readInt() - 1
  val A: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sorted
  val B: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sorted
  val C: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sorted

  var count = 0

  A.foreach(a => {
    B.filter(_ > a).foreach(b => count += C.filter(_ > b).length)
  })

  println(count)
}