#include <stdio.h>

int s[10000], n;

int binary(int);
int main()
{
    int i, k, q, sum = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &s[i]);
    scanf("%d", &q);
    scanf("%d", &q);
    for (i = 0; i < q; i++)
    {
        scanf("%d", &k);
        if (binary(k))
            sum++;
    }
    printf("%d\n", sum);
    return 0;
}
int binary(int k)
{
    int left = 0, right = n, mid;
    while (left < right)
    {
        mid = (left + right) / 2;
        if (k == s[mid])
            return 1;
        if (k > s[mid])
            left = mid + 1;
        else if (key < s[mid])
            right = mid;
    }
    return 0;
}
