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

#define MAX 10000


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

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

int main(void)
{
	int 	S[10000]				= {};
	char	str[30000000]				= {};
	int 	T[500]					= {};
	int 	n						= 0;
	int 	q						= 0;
	int 	i						= 0;
	int 	j						= i;
	int 	num						= 0;
	int     k                       = 0;
	fgets( str, 256, stdin );
	n = atoi(str);
	/*fgets( str, 20000000, 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++;
	}*/
	num = 0;
	while ( num < n-1 ) {
	    scanf("%d ", &S[num]);
	    num++;
	}
	scanf("%d\n", &S[num]);
	
	fgets( str, 256, stdin );
	q = atoi(str);
	
	num = 0;
	while ( num < q-1 ) {
	    scanf("%d ", &T[num]);
	    num++;
	}
	scanf("%d\n", &T[num]);
	/*
	fgets( str, 20000000, stdin );
	i = 0;
	num = 0;
	while ( num < q-1 ) {
		j = i;
		if ( num == 802 ) {
		    for ( k = 0; k < 10; k++ ) {
    		    printf("dump : %x\n", str[j+k]);
		    }
		}
		for ( i = 0; str[i] != 0x20; i++ ) {
		    if ( str[i] == '\r' || str[i] == '\n') {
		        break;
		    }
		}

		str[i] = '\0';
		if ( num == 802 ) {
		    for ( k = 0; k < 10; k++ ) {
    		    printf("xxdump : %x %x j-i:%d\n", str[j+k], ' ', j-i);
		    }
		}
		T[num] = atoi(&str[j]);
		if ( T[num] == 768 ) {
		    printf("num:%d error: %s\n", num ,&str[j]);
		}
		if ( num > 801 && num < 805) {
		    printf("num:%d error: %s value: %d \n", num ,&str[j], T[num]);
		}
		num++;
		i++;
	}
	
	printf("783: %d 803: %d\n", T[783], T[803]);
	*/

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

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

	return 0;
}


/*バーブルソート*/
int BubbleSort ( int *Arr, 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[j] < Arr[j-1] ) {
                tmp = Arr[j];
                Arr[j] = Arr[j-1];
                Arr[j-1] = tmp;
            }
        }
    }
    
	
	
    return 0;
}

int BibarySearch( int *A, int Max_order, int key )
{
	int left = 0;
	int right = 0;
	int mid = 0;
	
	right = Max_order;
	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;
}

