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).sortWith(_ > _)
  val C: Seq[Int] = io.StdIn.readLine().split(" ").map(_.toInt).sortWith(_ > _)

  var count: Int = 0

  var indexA = 0
  while (indexA <= N) {
    var indexB = 0
    while (indexB <= N && B(indexB) > A(indexA)) {
      var indexC = 0
      while (indexC <= N && C(indexC) > B(indexB)) {
        count += 1
        indexC += 1
      }
      indexB += 1
    }
    indexA += 1
  }

  println(count)
}