#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;

int main(void) {
	int n,q,temp;
	cin >> n;
	map<int,bool> memo;
	for (int i = 0; i < n; ++i) {
		cin >> temp;
		memo[temp] = true;
	}
	cin >> q;
	int res = 0;
	for (int i = 0; i < q; ++i) {
		cin >> temp;
		if (memo[temp]) {
			++res;
		}
	}
	cout << res << endl;
	return 0;
}

