/*
 * Binary Search.c
 *
 *  Created on: 2015/02/15
 */

#include <stdio.h>

int S[100000]={0},T[100000]={0};
int flag[1000]={0};

void printarray(int a[],int n){
	int i;
	for(i=0;i<n;i++){
		printf("%d ",a[i]);
	}printf("\n");
}

int main(){
	int n,q;
	int i,counter=0;
	int start,end;

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

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


	start=0,end=n-1;

	for(i=0;i<q;i++){
		int middle = (start+end)/2;
		while(end > start){
			if(S[middle] > T[i]){
				end = middle - 1;
			}
			else if(S[middle] < T[i]){
				start = middle + 1;
			}
			else if(S[middle] == T[i]){
				counter++;
				break;
			}
		}

	}

	printf("%d\n",counter);

	return 0;
}