#include <stdio.h>
#define Max 10700
int check(int a[],int key,int num){

  int i;
  for(i = 0;i < num;i++){
    if(a[i] == key) return -1;
  }

  return 0;
}
int main (){
  int n,s,q,t,i,j,dat1[Max],dat2[Max],con=0,temp;
 
 
  scanf("%d",&n);
  for ( j = 0;j < n;j++){
    if(scanf("%d",&dat1[j])==EOF)break;
  }
  scanf("%d",&q);

  while(i != q){
    scanf("%d",&temp);
    if(check(dat2,temp,i) != 0){
      q--;
      continue;
    }
    dat2[i] = temp;
    i++;
  }
 
  for ( i = 0;i < n;i++){
    for ( j = 0;j < q;j++){
      if(dat2[i] == dat1[j]){
    con++;
      }
    }
}
 
  printf("%d\n",con);
  return 0;
}