function main(lines) {
    const input = lines.split('\n')
    const setS = new Set(input[1].split(' ').map(Number))
    const setT = new Set(input[3].split(' ').map(Number))
    const S = Array.from(setS).sort(function(a,b){return a-b})
    const T = Array.from(setT).sort(function(a,b){return a-b})

    let count=0
    for(let i=0; i<S.length; i++){
        if(binarySearch(S[i])) count++
    }

    console.log(count)
    
    function binarySearch(key){
        let left = 0
        let right = T.length
        while(left<right){
            let mid = Math.floor((left+right)/2)
            if(key === T[mid]){
                return true;
            } else if(key>T[mid]){
                left = mid + 1;
            } else if(key<T[mid]){
                right = mid;
            }
        }
        
    }
}

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


