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

#define V(a) a.begin(), a.end()
typedef set<int> s;

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

	for (auto &i : a) {
		int n, x;
		cin >> n;
		while (n--) {
			cin >> x;
			i.insert(x);
		}
	}

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

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

#include <iostream>
using namespace std;

int main() {

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

    int q;
    cin >> q;
    int *T = new int[q];
    for (int i = 0; i < q; ++i) {
        cin >> T[i];
    }

    int count = 0;
    for (int i = 0; i < q; ++i) {
        for (int j = 0; j < n; ++j) {
            if (S[j] == T[i]) {
                ++count;
                break;
            }
        }
    }

    cout << count << endl;

    delete[] S;
    delete[] T;
    return 0;
}