#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

long i;
long r1[100000];

int main() {
	long q, n;
	scanf("%d", &n);
	long t;
	long counts = 0;
	for (i = 0; i < n; ++i) {
		scanf("%d", &r1[i]);
	}

	scanf("%d", &q);
	for (int j = 0; j < q; ++j) {
		scanf("%d", &t);
		if (*lower_bound(r1, r1 + n, t) == t)
			counts++;
	}
	printf("%d\n", counts);
	return 0;
}
