#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 100000

int s[MAX_N];
int n = 0;

bool
search(int x)
{
	int l = 0, r = n - 1;
	while (l <= r)
	{
		int i = (l + r) / 2;
		if (x > s[i])
			l = i + 1;

		else if (x < s[i])
			r = i - 1;

		else
			return true;
	}

	return false;
}

int
cmp_func(const void *l_, const void *r_)
{
	const int* l = (const int*) l_;
	const int* r = (const int*) r_;

	if (*l < *r)
		return -1;

	if (*l > *r)
		return 1;

	return 0;
}

int
main(int argc, char** argv)
{
	int q = 0;
	int t = 0;
	int i;

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

	qsort(s, n, sizeof(int), cmp_func);

	scanf("%d", &q);
	int count = 0;
	for (i = 0; i < q; ++i)
	{
		scanf("%d", &t);
		if (search(t))
			count++;
	}

	printf("%d\n", count);
	return 0;
}