function Main(input) {
  var data = input.split('\n');
  var sNum = parseInt(data.shift());
  var s = data.shift().split(' ');
  var tNum = parseInt(data.shift());
  var t = data.shift().split(' ');
  
  var num = t.filter(function(a){ return s.indexOf(a) !== -1;});
  console.log(num.length);
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));