import scala.io.StdIn

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

  val ans = {
    var cnt = 0
    for {
      i <- 0 until n
      ai = a(i)
      j <- 0 until n
      if b(j) > ai
      bj = b(j)
      k <- 0 until n
      if c(k) > bj
    } {
      cnt += 1
    }
    cnt
  }

  println(ans)
}