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

int isIn(int, int *, int);

int main(void)
{
  int n, q, i, count=0;
  scanf(" %d", &n);
  int *nArray = (int *) malloc(sizeof(int[n]));
  for (i=0; i<n; i++)
    scanf(" %d", nArray+i);
  scanf(" %d", &q);
  int *qArray = (int *) malloc(sizeof(int[q]));
  for (i=0; i<q; i++)
    scanf(" %d", qArray+i);
  for (i=0; i<q; i++)
    if (isIn(qArray[i], nArray, n))
      count++;
  printf("%d\n", count);
  return 0;
}

int isIn(int number, int *array, int length)
{
  int bottom=0, top=length-1;
  while (bottom!=top)
    {
      int mid=(bottom+top)/2;
      if (array[mid]==number)
	return 1;
      else if (array[mid]<number)
	bottom=mid;
      else
	top=mid;
    }
  return 0;
}

