#include<stdio.h>
#define N 10000
#define Q 500
int main()
{
  int n,q,i,j,count=0,S[N],T[N],key;

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

  scanf("%d",&q);
  for(j=0;j<=q-1;j++){
    scanf("%d",&T[j]);
}
 
 for(i=0;i<=n-1;i++){
   key=S[i];
   for(j=0;j<=q-1;j++){
     if(T[j]==key)
       count++;
     
   }
 }
 printf("%d\n",count);
 return 0;
}