function Main(input) {
  var data = input.split('\n');
  var sNum = parseInt(data.shift());
  var sArr = data.shift().split(' ').map(function(i) {
    parseInt(i);
  });
  var tNum = parseInt(data.shift());
  var tArr = data.shift().split(' ').map(function(i) {
    parseInt(i);
  });
  
  var cnt = 0;
  tArr.forEach(function(t){
    var start = 0, end = sArr.length - 1;
    while (start <= end) {
      var idx = parseInt((end - start) / 2) + start;
      var sCenter = sArr[idx];
      if (t === sCenter) {
        cnt++;
        break;
      } else if (start !== end) {
        if (t < sCenter) {
          end = idx;
        } else {
          start = idx + 1;
        }
      } else {
        break;
      }
    }
  });
  console.log(cnt);
}

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