'use strict'

function main(input){
  const lines = input.split('\n');
  const N  =parseInt(lines.shift());
  const A = lines.shift().split(' ').map(x => parseInt(x)).sort((a,b) => a-b);
  const B = lines.shift().split(' ').map(x => parseInt(x)).sort((a,b) => a-b);
  const C = lines.shift().split(' ').map(x => parseInt(x)).sort((a,b) => a-b);


//console.log(A);
//console.log(B);
//console.log(C);

  let result = 0;
  for(let a=0;a<N;a++){
    let current_a = A[a];
    for(let b=0;b<N;b++){
      let current_b = B[b];
      if(current_b <= current_a ){continue;}
      let rest_b_count = (N-b);
      for(let c=0;c<N;c++){
        let current_c = C[c];
        if(current_c <= current_b ){continue;}
        let rest_c_count = (N-c);
        result += rest_c_count;
        break;
      }
    }
  }

  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
