import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int[] a, int[] b, int[] c) {
    a.sort();
    b.sort();
    c.sort();

    int ans = 0;
    int n = cast(int)a.length;
    for (int i = 0; i < n; i++) {

        int lo = 0;
        int hi = n - 1;
        int na = 0;
        while (lo <= hi) {
            int m = (lo + hi) / 2;
            if (a[m] < b[i]) {
                na = m + 1;
                lo = m + 1;
            }
            else hi = m - 1;
        }

        lo = 0;
        hi = n - 1;
        int nc = 0;
        while (lo <= hi) {
            int m = (lo + hi) / 2;
            if (b[i] < c[m]) {
                nc = n - m;
                hi = m - 1;
            }
            else lo = m + 1;
        }

        ans += na * nc;
    }
    return ans;
}

void main() {
    readint;
    auto a = readints;
    auto b = readints;
    auto c = readints;
    writeln(calc(a, b, c));
}
