import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		int i,cnt=0,big,sma,mid;
		// TODO Auto-generated method stub
   Scanner sca=new Scanner(System.in);
    int hair1[]=new int[sca.nextInt()];
    for(i=0;i<hair1.length;i++){
    	hair1[i]=sca.nextInt();
    }
    int hair2[]=new int[sca.nextInt()];
    for(i=0;i<hair2.length;i++){
    	hair2[i]=sca.nextInt();
    }
    for(i=0;i<hair2.length;i++){
    	big=hair1.length;
    	sma=0;
    	while(sma<big){
    		mid=(big+sma)/2;
    		if(hair1[mid]==hair2[i]){
    			cnt++;
    			break;
    		}
    		if(hair1[mid]>hair2[i])big=mid;
    		if(hair1[mid]<hair2[i])sma=mid+1;
    		}
    	}
    System.out.println(cnt);
	}

}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz