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

int binarysearch(int);
int *A,*B,N,K;

int main()
{
  int i,j,count=0;

  scanf("%d",&N);
  A=(int *)malloc(sizeof(int)*N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);

  scanf("%d",&K);
  B=(int *)malloc(sizeof(int)*K);
  for(i=0;i<K;i++) scanf("%d",&B[i]);

  for(i=0;i<K;i++) count=count+binarysearch(B[i]);


  printf("%d\n",count);


  return 0;
}

int binarysearch(int key)
{
  int left,right,mid;

  left=0;
  right=N;
  while(left<right)
    {
      mid=(left+right)/2;
      if(A[mid]==key) return 1;
      else if(key<A[mid]) right=mid;
      else left=mid+1;
    }
  return 0;
  
}

