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

