#include<stdio.h>
int binSearch(int[], int, int);
int main(void){
    int i, n, q, C = 0, S[100000], T[50000];
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%d", &T[i]);
    }
    for(i = 0; i < q; i++){
        if(binSearch(S, n, T[i]) != -1) C++;
    }
    printf("%d\n", C);
    

    return 0;
}
int binSearch(int src[], int n, int dst){
    int head = 0, tail = n, mid;
    while(head < tail){
    mid = (head + tail) / 2;
    if(src[mid] == dst) return mid;
    else if(dst < src[mid]) tail = mid;
    else if (dst > src[mid]) head = mid + 1;
    }
    return -1;
}
