#include<fstream>
#include <algorithm>
#include<iostream>
#include<queue>
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 nhap()
{
	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 bs(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 xuli()
{
	int p=0;
	int d=0;
	for (i=1;i<=m;i++)
	{
		p=bs(a,1,m,b[i]);
		if(p==1)d++;
	}
	fo<<d;
	fi.close();
	fo.close();
}
int main()
{
	nhap();xuli();
}
