#include <iostream>
#include <set>
using namespace std;
int main(void)
{
	int n,q,k=0,num;
	set<int> set;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> num;
		set.insert(num);
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> num;
		if(set.find(num)!=set.end()) k+=1;
	}
	cout << k << endl;
	return 0;
}