"use strict";
    
function lowerBound(arr, n) {
    var first = 0, last = arr.length - 1, middle;
    while (first <= last) {
        middle = 0 | (first + last) / 2;
        if (arr[middle] < n) first = middle + 1;
        else last = middle - 1;
    }
    return first;
}

function upperBound(arr, n) {
    var first = 0, last = arr.length - 1, middle;
    while (first <= last) {
        middle = 0 | (first + last) / 2;
        if (arr[middle] <= n) first = middle + 1;
        else last = middle - 1;
    }
    return first;
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n)).sort((a,b)=>a-b);
    const B = arg[2].split(" ").map(n=>parseInt(n)).sort((a,b)=>a-b);
    const C = arg[3].split(" ").map(n=>parseInt(n)).sort((a,b)=>a-b);
    
    let answer = 0;
    
    for(let i=0; i<N; i++) {
        let top = lowerBound(A, B[i]);
        let bottom = upperBound(C, B[i]);
        
        answer += top * (N - bottom)
        
        // console.log("top:" + top);
        // console.log("bottom:" + bottom);
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));