"use strict"

//https://img.atcoder.jp/arc08        4/editorial.pdf

function main(input) {
  //binary search
  const bs = (arr, key) => {
    let left = 0
    let right = arr.length
    let mid = 0
    while (left < right) {
      mid = Math.floor((left + right) / 2)
      if (arr[mid] == key || (arr[mid] < key && key < arr[mid + 1])) {
        // arr[mid] == key
        return mid
      } else if (key < left[mid]) {
        right = mid
      } else {
        left = mid + 1
      }
    }
    return false // not found
  }
  // end of bs

  input = input.split(/\n/).map(v =>
    v
      .split(" ")
      .map(v => ~~v)
      .sort((a, b) => a - b)
  )
  const n = input[0][0]
  const items = input.slice(1, input.length)

  //
  let ans = 0
  for (let i1 = 0; i1 < n; i1++) {
    for (let i2 = 0; i2 < n; i2++) {
      if (items[0][i1] >= items[1][i2]) continue

      for (let i3 = 0; i3 < n; i3++) {
        if (items[1][i2] >= items[2][i3]) continue

        if (items[0][i1] < items[1][i2] && items[1][i2] < items[2][i3]) {
          //
          ans++
        }
      }
    }
  }

  console.log(ans)
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))