function main(lines) {
    const input = lines.split('\n')
    const inputS = input[1].split(' ').map(Number)
    const inputT = input[3].split(' ').map(Number)
    const arrayS = Array.from( new Set(inputS) )
    const arrayT = Array.from( new Set(inputT) )
    
    let count = 0
    for(let i=0; i<arrayS.length; i++){
        if(arrayT.includes(arrayS[i])){
            count++
        }
    }
    console.log(count)
}

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


