#include<stdio.h>

int S[10000];

int binaryserch(int q,int head ,int tail) {

    if (q == S[(head + tail) / 2])
        return 1;
    else if (q < S[(head + tail) / 2])
        binaryserch(q, head, (head + tail) / 2 - 1);
    else if(q > S[(head+tail)/2])
        binaryserch(q, (head + tail) / 2 +1,tail );

}


int main(void) {
    int i, j,q,n;
    int T[500];
    int count = 0;

    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++) {
        count += binaryserch(T[i],0,n-1);
    }

    printf("%d", count);

    return 0;
}