var stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
var input = stdin.split('\n');
var n = parseInt(input.shift(), 10);
var s = input.shift().split(' ').map(Number);
var q = parseInt(input.shift(), 10);
var t = input.shift().split(' ').map(Number);

var linearSearch = function(a, n, key) {
  a[n] = key;
  var i = 0;
  while (key != a[i]) {
    i += 1;
  }
  return i != n
};

var c = 0;
for (var i = 0; i < n; i += 1) {
  c += linearSearch(t, q, s[i]) ? 1 : 0;
}
console.log(c);