#include <fstream>
using namespace std;
int main ()
{
	ifstream f("dempt.inp");
	ofstream g("dempt.out");
	long long m,n,a[99999],b[99999],d[999999],dem=0;
	int i,j;
	f>>n;
	for (i=1;i<=n;i++)
	{ f>>a[i];
	  d[a[i]]=1; }
	f>>m;
	for (j=1;j<=m;j++)
	{ f>>b[j]; }
	for (i=1;i<=n;i++)
	for (j=1;j<=m;j++)
	{ 
	  if (d[b[j]]==1)
	  dem++;
	}
	g<<dem;
	f.close();
	g.close();
}
