#include<stdio.h>

void sort(int array[], int len)
{
	int i, j;
	for (i = 0; i < len; i++) {
		for (j = i + 1; j < len; j++) {
			if (array[i] > array[j]) {
				int tmp = array[i];
				array[i] = array[j];
				array[j] = tmp;
			}
		}
	}
}

int main(){
	int i, j, n, q, t, count = 0, index = 0;
	int S[100000];
	int T[50000];

	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]);
	}
	sort(T, q);
	for (j = 0; j < q; j++) {
		for (i = index; i < n && S[n - 1] >= T[j] && S[i] <= T[j]; i++) {
			if (S[i] == T[j]) {
				index = i;
				count++;
				break;
			}
		}
	}
	printf("%d\n", count);
	return 0;
}