#include <stdio.h>
#define N 100000

int Search(int* S,int Tv,int n){
	int i;
	int mid,head,tail;
	if(S[0]==Tv||S[n-1]==Tv)return 1;
	head = 0;
	tail = n-1;
	while(head<tail){
		mid = (tail+head)/2;
		if(Tv==S[mid])return 1;
		else if(Tv>S[mid])tail=mid;
		else head=mid+1;
	}
	return 0;
}


int main(int argc,char* argv[]){
	int S[N],T[N/2],V[N/2];
	int n,q;

	int i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&S[i]);
	}

	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&T[i]);
	}

	int count = 0;
/*	if(!Search(S,T[0],n)){
		count++;
		printf("%d",T[0]);
	}
*/
	for(i=0;i<q;i++){
		if(Search(S,T[i],n)){
			V[count]=T[i];
			count++;
		}
	}
/*	if(count!=0)printf("%d",V[0]);
	for(i=1;i<count;i++){
		printf(" %d",V[i]);

	}
	printf("\n");
*/	printf("%d\n",count);

	return 0;
}