import java.util.*;
class  Main{
	Scanner sc= new Scanner(System.in);
	void aaaa(){
		int gundam=0;
		int n=sc.nextInt();
		int[] N=new int[n];
		for(int i=0;i<n;i++)N[i]=sc.nextInt();
		int q=sc.nextInt();
		for(int i=0;i<q;i++){
			int Q=sc.nextInt();
			int L=0;
			int R=n-1;
			while(N[L]<=Q&&Q<=N[R]){
				int cent=(L+R)/2;
				if(N[cent]==Q){
					gundam++;
					break;
				}else if(N[cent]>Q)R=cent-1;
				else L=cent+1;
			}
		}
		System.out.println(gundam);
	}
	public static void main(String[]args){
		new Main().aaaa();
	}
}
/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