#include <stdio.h>



#define N 100000
#define Q 50000



void display(int data[], int n);

void bubbleSort(int data[], int n);
void selectionSort(int data[], int n);
void insertionSort(int data[], int n);

int binarySearchTF(int key, int data[], int n);



int main(){
	
	//??????
	int data[N];
	
	int S[N];
	int T[Q];
	
	
	//??其?????即?????属
	int i, k;
	
	//?????????????卒???属
	int n, q;
	
	//?????属, ?????属??????
	int count = 0;
	
	
	//????卒???属?????\???
	scanf("%d", &n);	
	
	//??????????????\???
	for(i=0; i<n; i++){
		
		scanf("%d", &S[i]);
		
	}
	
	scanf("%d", &q);
	
	for(i=0; i<q; i++){
		
		scanf("%d", &T[i]);
		
	}
	
	
	//insertionSort(S, n);
	
	for(i=0; i<q; i++){
		
		if(binarySearchTF(T[i], S, n)){
			
			count++;
			
		}
		
	}
	
	printf("%d\n", count);
	
	return 0;
	
}



//?????????????卒???????????????????
void display(int data[], int n){
	
	int i;
	
	for(i=0; i<n; i++){
		if(i>0){
			printf(" ");
		}
		printf("%d", data[i]);
	}
	
	printf("\n");
	
	return;
}



//??????????????????
void bubbleSort(int data[], int n){
	
	int i, j, temp;
	int count = 0;
	
	for(i=0; i<n; i++){
		
		for(j=n-1; j>i; j--){
			
			if(data[j] < data[j-1]){
				
				temp = data[j];
				data[j] = data[j-1];
				data[j-1] = temp;
				
				//?????属????即????
				count++;
				
			}
			
		}
		
		//???????????其????????????
		//display(data, n);
		
	}
	
	
	//??????
	//display(data, n);
	
	//???????????属?????????
	//printf("%d\n", count);
	
	return;
}



//???????????????
void selectionSort(int data[], int n){
	
	int i, k, temp;
	int min = 0;
	int count = 0;
	
	for(i=0; i<n; i++){
		
		min = i;
		
		for(k=i+1; k<n; k++){
			
			if(data[min] > data[k]){
				
				min = k;
				
			}
			
		}
		
		
		//min > i  ???  ??????????????????
		if(min > i){
			
			temp = data[min];
			data[min] = data[i];
			data[i] = temp;
			
			count++;
		}
		
	}
	
	display(data, n);
	
	//???????????属?????????
	//printf("%d\n", count);
	
	return;
}



//?????\?????????
void insertionSort(int data[], int n){
	
	int i, j, temp;
	
	for(i=1; i<n; i++){
		
		j = i;
		temp = data[j];
		
		while(j>0 && temp < data[j-1]){
			
			data[j] = data[j-1];
			j--;
			
		}
		data[j] = temp;
		
		//???????????其????????????
		//display(data, n);
	}
	
	return;
}



//????????蔵?卒蔵	??????????????????(0 or 1)?????????
int binarySearchTF(int key, int data[], int n){
	
	int min = 0,  max = n-1, pos = (min+max)/2;
	
	while(min <= max){
		
		if(key < data[pos]){
			
			max = pos-1;
			pos = (min+max)/2;
			
		}
		else if(key > data[pos]){
			
			min = pos+1;
			pos = (min+max)/2;
			
		}
		else{
			
			return 1;
			
		}
		
	}
	
	return 0;
	
}