#include <stdio.h>

int main(void){
	int n,q;
	int s[10000],t[500];
	int i,c=0;
	int left,right,center;

	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]);
	}
	
	for(i=0;i<q;++i){
		left = 0;
		right = n+1;
		while(left<right){
			center = (left+right)/2;
			if(s[center]==t[i]){
				c++;
				break;
			}else if(s[center]>t[i]){
				right = center;
			}else{
				left = center+1;				
			}
		}
	}
	printf("%d\n",c);
	
	return 0;
}