(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var N = parseInt(lines[0])
      var A = lines[1].split(" ")
      var B = lines[2].split(" ")
      var C = lines[3].split(" ")
      var ans = 0

      for (var ai=0;ai<N;ai++){
          for (var bi=0;bi<N;bi++){
              if( parseInt(A[ai]) < parseInt(B[bi]) ) {
//                  console.log("A:"+A[ai] + " B:"+B[bi])
                for (var ci=0;ci<N;ci++){
                    if( parseInt(B[bi]) < parseInt(C[ci])  ){
//                        console.log("ai:"+ai + " bi:"+bi + " ci:"+ci)
                        ans++
                    }
                 }
               }
          }
       }

    console.log(ans)
      
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();

