#include<stdio.h>
int binarySearch(int *A, int key, int n);
int main() {
	int S[110000];
	int T[51000];
	int n, q, i, j;
	int x = 0, xflag;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &S[i]);
	}
	scanf("%d", &q);
	for (j = 0; j < q; j++) {
		scanf("%d", &T[j]);
	}
	for (j = 0; j < q; j++) {
		if (binarySearch(S, T[j], n) != -1) {
			x++;
		}
	}
	printf("%d\n", x);
	
	return 0;
}

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