object Main extends App {
	import scala.math._
	import scala.io.StdIn._

	val N = readInt
	val A = readLine.split(" ").map(_.toLong).sorted
	val B = readLine.split(" ").map(_.toLong).sorted
	val C = readLine.split(" ").map(_.toLong).sorted

	var result = 0L

	for(i<-0 until N){
		for(j<-0 until N){
			if(A(i) < B(j)){
				result = result + C.filter(_ > B(j)).size.toLong
			}
		}
	}

	println(result)

}
