#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>

int data_n[10002];
int data_q[502];
int mach_data[502];
int mach_num;


/**------------ SUB ROUTIONE -------------*/
/**------------ SUB ROUTIONE -------------*/
int main()
{
	int  n,q,i,k,dt;
	int *sch_p;
	static char inp[10002];
	char *tr_p;
	char *wk_p;
	/** INIT **/
	mach_num = 0;

	/** INPUT **/
	gets(inp);

	/***************/
	/*--- n     ---*/
	/***************/
	sscanf(inp,"%d",&n);

	gets(inp);
	tr_p = strtok( inp," ");
	for(i=0 ;; i++) {
		if (tr_p == NULL) {
			break;
		}
		sscanf(tr_p,"%d",&data_n[i]);
		tr_p = strtok( NULL," ");
	}
	/***************/
	/*--- q     ---*/
	/***************/
	gets(inp);
	sscanf(inp,"%d",&q);

	gets(inp);
	tr_p = strtok( inp," ");
	for(i=0 ;; i++) {
		if (tr_p == NULL) {
			break;
		}
		sscanf(tr_p,"%d",&data_q[i]);
		tr_p = strtok( NULL," ");
	}

	/*--- CALC ---*/
	for (i=0 ; i<q ; i++) {
		dt = data_q[i];
		sch_p = &(data_n[0]);
 		for (k=0 ; k<n ; k++,sch_p++) {
			if (dt == *sch_p) {
				mach_data[mach_num] = *sch_p;
				mach_num++;
				break;
			}
		}
	}

	/*---- OUTPUT ----*/
	printf("%d\n",mach_num);
	return 0;
}