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

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

let N1 = readlineSync.question();
let arr1 = readlineSync.question().split(' ').map(i => Number(i));
let N2 = readlineSync.question();
let arr2 = readlineSync.question().split(' ').map(i => Number(i));

console.log(arr2.map(e => linearSearch(e, arr1)).reduce((a, b) => a + b, 0));

