#include <stdio.h>
#define n 10000

int main(){
  int count=0,i,j,key,num1,num2;
  int row[n];


  scanf("%d",&num1);
  for(i=0;i<num1;i++)scanf("%d",&row[i]);
  scanf("%d",&num2);
  for(i=0;i<num2;i++){
    scanf("%d",&key);

  for(j=0;j<num1;j++){
    if(row[j]==key)count++;
  }
}

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