

#include <stdio.h>
#include <stdlib.h>
int binarysearch(int a, int number, int *array);
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; 
    int left,right,mid;
    left=0;
    right = number1-1;
    for(int i=0;i<number2;i++)
    {
        while(left < right)
        {
            mid = (left +right )/2;
            if(array2[i] == array1[mid])
            {
               count++;
               break;
            }
            if(array2[i] > array1[mid])
            {
                left = mid+1;
            }
            if(array2[i] < array1[mid])
            {
                right = mid;
         }
    }
    }
    printf("%d\n", count);
    return (EXIT_SUCCESS);
}

