function main(input){
    let int =parseInt;
    let lines = input.split("\n");
    let sLen = int(lines[0]);
    let tLen = int(lines[2]);
    let s = lines[1].split(" ").map(item=>int(item));
    let t = lines[3].split(" ").map(item=>int(item));
    let count = 0;

    
    for(let i=0;i<tLen;i++){
        let left = 0;
        let right = sLen;
        let middle =Math.floor((left+right)/2);
        
        while(left<right){
            middle =Math.floor((left+right)/2);
            if(s[middle]===t[i]){
                count++;
                break;
            }else if(s[middle]>t[i]){
                right = middle;
            }else{
                left = middle+1;
            }
            

        }
    }
    console.log(count);
    
    
}


main(require("fs").readFileSync("/dev/stdin","utf-8"));
