object Main {
  def main(args: Array[String]) {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val an = List.fill(n)(sc.nextInt).sorted.to[Vector]
    val bn = List.fill(n)(sc.nextInt).sorted.to[Vector]
    val cn = List.fill(n)(sc.nextInt).sorted.to[Vector]

    val counts = an.par.map{ a =>
      bn.par.filter( _ > a ).map{ b =>
        cn.par.filter( _ > b ).length
      }.sum
    }

    println(counts.sum)
  }
}
