#include<bits/stdc++.h>
using namespace std;
int n,m,i,a[10000],b[10000];
priority_queue <int> p,q;
ifstream fi("dempt.inp");
ofstream fo("dempt.out");
void input()
{
	fi>>n;
	for (i=1;i<=n;i++)
		{
			int x;
			fi>>x;
			p.push(x);
		}
	for (i=1;i<=n;i++)
		{
			a[i]=p.top();
			p.pop();
		}
	fi>>m;
	for (i=1;i<=m;i++)
		{
			fi>>b[i];
		}
}
int run(int arr[], int l, int r, int x)
{
    if (r >= l)
    {
        int mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return 1;
        if (arr[mid] > x)
            return bs(arr, l, mid - 1, x);
        else
            return bs(arr, mid + 1, r, x);
    }
    return -1;
}
void output()
{
	int p=0;
	int d=0;
	for (i=1;i<=m;i++)
	{
		p=run(a,1,m,b[i]);
		if(p==1)
        {
            d++;
        }
	}
	fo<<d;
}
int main()
{
	input();
	output();
}
