#include <stdio.h>
 
int main()
{
    int n, S[100], q, T[100], i, j;
    int same = 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 < n; i++) {
        for (j = 0; j < q; j++) {
            if (S[i] == T[j])
                same += 1;
        }
    }
    printf("\n");
    printf("%d\n", same);

    return 0;
}