#include <stdio.h>
#define Found 1
#define Not_Found 0
#define MAX 10000
#define max 500

int LinerSearch(int *,int);

int main(){

	int S[MAX],T[max],q,count,i,n;

	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]);
		if(LinerSearch(S,T[i],n) == Found) count++;
	}

	printf("%d",count);

	return 0;

}


int LinerSearch(int *A,int key,int n){

	int i = 0;
	
	for( i = 0; i < n; i++){
		 if(A[i] == key) return Found; 
	}
	return Not_Found;
}
