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

int main(){
    int n,q;
    int cnt=0;
    cin>>n;
    vector<int>s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    cin>>q;
    vector<int>t(q);
    for(int i=0;i<q;i++){
        cin>>t[i];
    }
    for(int i=0;i<q;i++){
        for(int j=0;j<n;j++){
            if(s[j]==t[i]){
                cnt++;
                break;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

bool Bsearch(int key, int A[], int len) {
	int l = 0, r = len - 1;
	while (l <= r) {
		int mid = l + (r - l) / 2;
		if (A[mid] > key)
			r = mid - 1;
		else if (A[mid] < key)
			l = mid + 1;
		else
			return true;
	}
	return false;
}

int main() {
	int n, *S;
	int q, *T;
	int ans = 0;
	cin >> n;
	S = new int[n];
	for (int i = 0; i < n; i++)
		cin >> S[i];
	cin >> q;
	T = new int[q];
	for (int i = 0; i < q; i++)
		cin >> T[i];

	sort(S, S + n);
	for (int i = 0; i < q; i++)
		for (int j = 0; j < n; j++)
			if (Bsearch(T[i], S, n) == true) {
				ans++;
				break;
			}

	cout << ans << endl;
	delete[] S;
	delete[] T;
	return 0;
}