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

int linearSearch(int);

int s[10000], t[501], q;

int main()
{
  int n, i, count=0;
  FILE *fp;
  fp = fopen("ALDS1_4_A_in8.txt","r");

  fscanf(fp,"%d",&n);
  for( i=0 ; i<n ; i++ )
    fscanf(fp,"%d",&s[i]);
  fscanf(fp,"%d",&q);
  for( i=0 ; i<q ; i++ )
    fscanf(fp,"%d",&t[i]);

  for( i=0 ; i<n ; i++ )
    if(linearSearch(s[i])>=0) count++;
  printf("%d\n",count);
  fclose(fp);

  return 0;
}

int linearSearch(int key)
{
  int i=0;
  t[q]=key;
  while(t[i]!=key){
    i++;

  }
  if(i==q) return -1;
  return i;
}