#include<stdio.h>
#include<stdlib.h>
#define nmax 10000
#define qmax 500

int binarySearch(int);

int T[qmax],q,count;
int judge[qmax];

int main()
{
  int n;
  int S[nmax],i,flag,j,x;

  scanf("%d",&n);

  for( i = 0 ; i < n ; i++ )
    {
      scanf("%d",&S[i]);
    }

  scanf("%d",&q);

  for( i = 0 ; i < q ; i++ )
    {
      scanf("%d",&T[i]);
    }

  for( i = 0 ; i < n ; i++ )
    { 
      x = binarySearch(S[i]);
      if( x != -1 ){
	flag = 1;
 	for( j = 0 ; j < count ; j++ )
	  {
	    if( judge[j] == x )
	      flag = 0;
	  }
	if( flag == 1 )
	  {
	    judge[j] = x;
	    count++;
	  }
      }
    }
  printf("%d\n",count);

  return 0;
}


int binarySearch(int key)
{
  int left,right,mid;
  
  left = 0;
  right = q;
  while( left < right )
    {

      mid = (left + right)/2;
      if( T[mid] == key )
	return mid;
      else if( key < T[mid] )
	right = mid;
      else 
	left = mid + 1;
    }
  return -1;

}