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)
    val bn = List.fill(n)(sc.nextInt)
    val cn = List.fill(n)(sc.nextInt)

    var count = 0
    an.foreach{ a =>
      bn.filter(_ > a).foreach { b =>
        count += cn.filter(_ > b).length
      }
    }

    println(count)

  }
}
