#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define V(a) a.begin(), a.end()
typedef vector<int> vi;

int main()
{
	vi a[2], C;

	for (auto &i : a) {
		int n;
		cin >> n;
		i = vi(n);
		for (int &j : i)
			cin >> j;
		sort(V(i));
	}

	set_intersection(V(a[0]), V(a[1]), inserter(C, C.end()));

	cout << C.size() << endl;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>

using namespace std;
#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = 0 ; i < a ; i ++)
#define vi vector<int>

int main(void){
	int s,t,r=0;
	cin>>s;
	vi sv(s);
	rep(i,s)cin>>sv[i];
	cin>>t;
	vi tv(t);
	rep(i,t){
		cin>>tv[i];
		rep(j,s){
			if(sv[j] == tv[i]){
				r++;
				break;
			}
		}
	}
	cout<<r<<endl;
}	