#include <stdio.h>
#define n 10000
#define p 500
int main(){
  int row1[n],row2[n],i,j,count=0,num1,num2;



  scanf("%d",&num1);
  for(i=0;i<num1;i++)scanf("%d",&row1[i]);
  scanf("%d",&num2);
  for(i=0;i<num2;i++)scanf("%d",&row2[i]);

  for(i=0;i<num1;i++){
    for(j=0;j<num2;j++){
      if(row1[i]==row2[j])count++;
    }
  }

  printf("%d\n",count);
}