var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0]);
    var A = lines[1].split(" ").map(i => Number(i))
    var B = lines[2].split(" ").map(i => Number(i))
    var C = lines[3].split(" ").map(i => Number(i))

    A.sort((a, b) => a - b); var A_min = A[0];
    B.sort((a, b) => a - b); var B_min = B[0];
    C.sort((a, b) => a - b); var C_min = C[0];

    var ans = 0;
    for (var c = 0; c < N; c++) {
        if (C[c] <= B_min) { continue; }

        for (var b = 0; b < N; b++) {
            if (C[c] <= B[b]) { break; }
            if (B[b] <= A_min) { continue; }

            for (var a = 0; a < N; a++) {
                if (B[b] <= A[a]) { break; }

                ans++;
            }
        }
    }
    console.log(ans);
});
