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

int main() {
    int n, a[100000];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int q, key, sum = 0;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> key;
        if (*lower_bound(a, a + n, key) == key) {
            sum++;
        }
    }
    cout << sum << endl;
}

