#include <stdio.h>
#define Max 10000000
int main (){
  int n,s,q,t,i,j,dat1[Max],dat2[Max],con=0;


  scanf("%d",&n);
  for ( j = 0;j < n;j++){
    if(scanf("%d",&dat1[j])==EOF)break;
  }
  scanf("%d",&q);
  for ( j = 0;j < q;j++){
    if(scanf("%d",&dat2[j])==EOF)break;
  }

  for ( i = 0;i < q;i++){
    for ( j = 0;j < n;j++){
      if(dat2[i] == dat1[j]){
	con++;
      }
    }
}

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