#include<stdio.h>
#define n 10000
#define q 500

int main(){
  
  int s[n],t[q],c=0,countn,countq,i,j;
  
  scanf("%d",&countn);
  for(i = 0; i < countn; i++){
    
    scanf("%d",&s[i]);
  }
  scanf("%d",&countq);
  for(i = 0; i < countq; i++){
    
    scanf("%d",&t[i]);
  }

  for(i = 0; i < countn; i++){
    for(j = 0; j < countq; j++){

      if(s[i] == t[j]) c++;
    }
  }

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

  return 0;
}