#include <bits/stdc++.h>

using namespace std;

int main(){
	
	int n, q;
	cin >> n;
	vector<int> s(n);

	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	cin >> q;
	int t;
	int counter = 0;
	for (int i = 0; i < q; i++) {
		cin >> t;
		counter += binary_search(s.begin(), s.end(), t);
	}

	cout << counter << endl;


	return 0;
}
