process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', chunk => {
  const input = chunk.toString().trim().split('\n');
  const a = input[1].split(' ');
  const b = input[2].split(' ');
  const c = input[3].split(' ');

  let count = 0;
  for (let i=0; i<a.length; i++) {
    for (let j=0; j<b.length; j++) {
      if (Number(a[i]) >= Number(b[j])) {
        continue;
      }

      for (let k=0; k<c.length; k++) {
        if (Number(b[j]) >= Number(c[k])) {
          continue;
        }
        count++;
      }
    }
  }

  console.log(count);

});
