#include <stdio.h>
#include <stdlib.h>

#define MAX 10000


/*バーブルソート*/
int BubbleSort ( int *Arr, int *Order, int Max_order );

/*表示*/
int Display_Arr ( char *name, int *Arr, int *Order, int Max_order );

int BibarySearch( int *A, int Max_order, int key );

int main(void)
{
	int		Order[MAX]				= {};			/* 安定判定のためのもの */
	char	str[2000000]				= {};
	int 	S[10000]				= {};
	int 	S2[10000]				= {};
	int 	T[500]					= {};
	int 	n						= 0;
	int 	q						= 0;
	int 	i						= 0;
	int 	j						= i;
	int 	num						= 0;
	fgets( str, 256, stdin );
	n = atoi(str);
	fgets( str, 2000000, stdin );
	while ( num < n ) {
		j = i;
		for ( i = 0; str[i] != ' ' && str[i] != '\r'; i++ ) {
		}
		str[i] = '\0';
		S[num] = atoi(&str[j]);
		num++;
		i++;
	}
	
	fgets( str, 256, stdin );
	q = atoi(str);
	fgets( str, 2000000, stdin );
	i = 0;
	num = 0;
	while ( num < q ) {
		j = i;
		for ( i = 0; str[i] != ' ' && str[i] != '\r'; i++ ) {
		}
		str[i] = '\0';
		T[num] = atoi(&str[j]);
		num++;
		i++;
	}
	

	/* 順序の初期化 */
	for ( i = 0; i < n; i++ ) {
	    Order[i] = i;
	}

	/* バーブルソート */
	BubbleSort( S, Order, n );

	for ( i = 0; i < n; i++ ) {
		S2[i] = S[Order[i]];
//		printf("%d %d \n", i, S2[i]);
	}
	num = 0;
	for ( i = 0; i < q; i++ ) {
//	    printf("judge = %d 値: %d\n", BibarySearch( S2, n, T[i] ), T[i]);
		if ( 0 <= BibarySearch( S2, n, T[i] ) ) {
			num++;
		}
	}
	
	printf("%d\n", num );

	return 0;
}


/*バーブルソート*/
int BubbleSort ( int *Arr, int *Order, int Max_order )
{
    int i = 0;		/* ループ 			*/
    int j = 0;		/* ループ 			*/
    int tmp = 0;	/* 入れ替えのダミー */
    
	
	/* メインループ */
    for ( i = 0; i < Max_order; i++ ) {
    	/* 一番後ろから手前のものと大きさを比べるループ */
        for ( j = Max_order - 1; j > i; j-- ) {
        	/* 大きさを比べて入れかえをする */
            if ( Arr[Order[j]] < Arr[Order[j-1]] ) {
                tmp = Order[j];
                Order[j] = Order[j-1];
                Order[j-1] = tmp;
            }
        }
    }
    
	
	
    return 0;
}

int Display_Arr ( char *name, int *Arr, int *Order, int Max_order )
{
	int i = 0;
	for ( i = 0; i < Max_order-1; i++ ) {
	    printf("%c%d ", name[Order[i]], Arr[Order[i]]);
	}

	printf("%c%d\n", name[Order[i]], Arr[Order[i]]);

	return 0;
}

int BibarySearch( int *A, int Max_order, int key )
{
	int left = 0;
	int right = 0;
	int mid = 0;
	
	right = Max_order - 1;
	
	while( left < right ) {
		mid = (left + right)/2;
		if ( A[mid] == key ) {
			return mid;
		} else if ( key < A[mid] ) {
			right = mid;
		} else {
			left = mid+1;
		}
	}
	
	return -1;
}
