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

int main(void)
{
	int s_length, q_length, i, z = 0, x, j;
	int *s, *q;
	scanf("%d", &s_length);
	s = (int *)malloc(sizeof(int) * s_length);//int型nメモリ分の確保
	
	for(i = 0;i < s_length;i++){//配列に値を代入
		scanf("%d", &s[i]);//i = s_lengthの配列
	}
	
	scanf("%d", &q_length);
	
	q = (int *)malloc(sizeof(int) * q_length);//int型pメモリ分の確保
	
	for(x = 0;x < q_length;x++){
		scanf("%d", &array[x]);1//x = q_lengthの配列
	}
		
	for(i = 0;i < q_length;i++){
		for(j = 0j < s_length;j++){
			if(q[i] == s[j]){
				z++;
				break;
			}
		}
		
	}
	
	printf("%d\n", z);
			
	return 0;
	
	
}