#include <stdio.h>
#define buf 1000001
int i,j,a,c,d,cnt=0,b[buf],left,right,mid,key;
void binary_search(int d);

int main(void){
	scanf("%d",&a);
	for(i=0;i<a;i++)
		scanf("%d",&b[i]);
	scanf("%d",&c);
	for(j=0;j<c;j++){
		scanf("%d",&d);
    		binary_search(d);
	}
	printf("%d\n",cnt);
	return 0;
}

void binary_search(int d){
	left = 0;
	right = a;
	while(left < right){
		mid = (left + right)/2;
		if(b[mid] == d){
			cnt++;
			break;
		}
        	else if(d < b[mid])
            		right = mid;
        	else if(d > b[mid])
            		left = mid+1;
	}
}