#include <stdio.h>
#define MAX 10000

void linearSearch( int * array_s, int * array_t, int n, int q )
{
	int match_number = 0;
	int i = 0, j = 0;

	for ( i = 0 ; i < q; i = i + 1 )
	{
		for( j = 0 ; j < n ; j = j + 1 )
		{
			if ( array_s[j] == array_t[i] )
			{
				match_number = match_number + 1;
				break;
			}
		}
	}

	fprintf( stdout, "%d\n", match_number );
}

int main()
{
	int i;
	int n;
	int S[MAX];

	int q;
	int T[MAX];

	scanf( "%d", &n );
	for ( i = 0 ; i < n ; i = i + 1 )
	{
		scanf( "%d", &S[i] );
	}

	scanf( "%d", &q );
	for( i = 0 ; i < q ; i = i + 1 )
	{
		scanf( "%d", &T[i] );
	}

	linearSearch( S, T, n, q );

	return 0;
}