#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

ifstream input("DEMPT.inp");
ofstream output("DEMPT.out");

int main()
{
	int m, n;
	int total = 0;
	int index = 0;
	input >> m;
	m++;
	vector <int> a(m);
	for (int i = 0; i < m; i++)
	{
		input >> a[i];
	}
	input >> n;
	n++;
	vector <int> b(n);
	for (int i = 0; i < n; i++)
	{
		input >> b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	for (int i = 0; i < n; i++)
	{
		for (int j = index; j < m; j++)
		{
			if (b[i] > a[j])
			{
				index++;
			}
			else break;
		}
		if (index < m)
		{
			if (b[i] == a[index]) total++;
		}
		else
		{
			output << total;
			return 0;
		}
	}
	output << total;
	input.close();
	output.close();
	return 0;
}