import std.algorithm,
       std.string,
       std.stdio,
       std.range,
       std.conv;

void main() {
  string N = readln.chomp;
  auto A = readln.chomp.split.to!(ulong[]).sort!"a<b",
       B = readln.chomp.split.to!(ulong[]).sort!"a<b",
       C = readln.chomp.split.to!(ulong[]).sort!"a<b";
  ulong[] bs;
  ulong c;

  foreach (a; A) {
    bs ~= B.upperBound(a).release;
  }
  bs.sort!"a<b";
  foreach (b; bs) {
    c += C.upperBound(b).length;
  }

  writeln(c);
}
