function main(_stdin) {
    const stdin = _stdin.trim().split('\n');
    const n = Number(stdin[0]);
    const S = stdin[1].split(' ').map(Number);
    const T = stdin[3].split(' ').map(Number);

    const SinT = T.filter(e =>  binarySearch(e, 0, n, S));
    console.log(SinT.length);
}

function binarySearch(target, left, right, array){
    while(left < right){
        const mid = Math.floor((right + left) / 2);

        if(array[mid] === target) {
            return true;
        }
        else if(array[mid] > target) {
            right = mid;
        }
        else {
            left = mid + 1;
        }
    }
    return false;
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

