var binarySearch = function(key, n, arr) {
  var left = 0, right = n;
  while (left < right) {
    var mid = Math.floor((left + right) / 2);
    if (arr[mid] === key) {
      return true;
    } else if (key < arr[mid]) {
      right = mid;
    } else {
      left = mid + 1;
    }
  }
  return false;
};

var countCommonNumber = function(n, s, q, t) {
  var counter = 0;
  for (var i = 0; i < q; i += 1) {
    counter += binarySearch(t[i], n, s) ? 1 : 0;
  }
  return counter;
};

(function(stdin) {
  var line = stdin.split('\n');
  var n = parseInt(line[0], 10);
  var s = line[1].split(' ').map(Number);
  var q = parseInt(line[2], 10);
  var t = line[3].split(' ').map(Number);
  console.log(countCommonNumber(n, s, q, t));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));