

#include <stdio.h>
#include <stdlib.h>
int binarySerch(int *array,int number, int key);
int main(int argc, char** argv) {
    int number1,number2;
    int readScan = scanf("%d", &number1);
    int array1[number1];
    for(int i=0;i<number1;i++)
    {
        int readScan = scanf("%d", &array1[i]);
    }
    int readScan1 = scanf("%d", &number2);
    int array2[number2];
    for(int i=0;i<number2;i++)
    {
        int readScan = scanf("%d", &array2[i]);
    }
    int key;
    int count=0; 
    int left,right,mid;
    left=0;
    right = number1-1;
    for(int i=0;i<number2;i++)
    {
        if(binarySerch(array1, number1,array2[i]) != NULL)
            count++;
    }
    printf("%d\n", count);
    return(0);
}
int binarySerch(int *array,int number, int key)
{
    int left, right, mid;
    left = 0;
    right = number-1;
    while(left<right)
    {
        mid = (left + right)/2;
        if(key == array[mid])
            return mid;
        if(key > array[mid])
            left = mid +1;
        if(key < array[mid])
            right = mid;
    }
    return NULL;
}


