#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;
}
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

using namespace std;

int ar_s[10000];
bool linear_search(int t, int n){
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (ar_s[i] == t) return true;
    }
    return false;
}

int main(int argc, char const* argv[])
{
    int n,q,  c = 0;

    scanf("%d ", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d ", &ar_s[i]);
    }

    scanf("%d ", &q);
    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d ", &t);
        linear_search(t, n) ? ++c : 0;
    }
    
    printf("%d\n", c);
    
    return 0;
}