#include <stdio.h>

int main(void)
{
	int n,S[10000],i,q,T[500],t,C;
	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]);
	}
	C=0;
	for (i=0;i<q;i++){
		for (t=0;t<n;t++){
			if(T[i]==S[t]){
				C=C+1;
			}
		}
	}
	printf("%d",C);
}