#include <stdio.h>

#define LEN 100000

int n;
int S[LEN];

int binarySearch(int left, int right, int target) {
    if (left > right) return 0;

    int mid = (left + right) / 2;
    if (target == S[mid]) return 1;

    if (target > S[mid]) {
        return binarySearch(mid + 1, right, target);

    } else {
        return binarySearch(left, mid, target);
    }
}

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

    int q;
    scanf("%d", &q);

    int cnt = 0;
    for (int i = 0; i < q; i++) {
        int k;
        scanf("%d", &k);
        if (binarySearch(0, n - 1, k)) cnt++;
    }

    printf("%d\n", cnt);

    return 0;
}

