#include <stdio.h>
#include <stdlib.h>

int s[200000];
int t[65536];

int compare(const void* a, const void* b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
    int n;
    int q;
    int cnt;
    int i, j;

    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);
    }

    qsort(t, q, sizeof(int), compare);

    cnt = 0;
    for (i = 0; i < n; ++i){
        if (bsearch(s + i, t, q, sizeof(int), compare) != NULL){
            ++cnt;
        }
    }
    printf("%d\n", cnt);

    return (0);
}