const readlineSync = require('readline-sync');

const linearSearch = (key, arr) => typeof arr.find(e => e == key) !== 'undefined' ? 1 : 0;

var lines = []
var cnt = 0

function main() {
  let arr1 = lines[1].split(' ').map(n => Number(n))
  let arr2 = lines[3].split(' ').map(n => Number(n))
  console.log(arr2.map(e => linearSearch(e, arr1)).reduce((a, b) => a + b, 0));
}


process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    lines.push(chunk.toString().replace(/\n/g, ''));
    cnt++;
    if (cnt === 4) main();
});

