#include<stdio.h>
#define N 10000
#define q 500
int linearSearch();


int main(){
  int a[N],b[q],x,y,i,j,count=0;

  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",&a[i]);
  }
   scanf("%d",&y);
  for(i=0;i<y;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<x;i++){
      for(j=0;j<y;j++){
	if(a[i]==b[j]) {
	  count++;
	  continue;
	}
      }
  }
  printf("%d\n",count);
  
  return 0;
}